Site icon New Generation Enterprise Linux

Taming Process Output: Focused `ps` with `awk`

Quick Tip

Taming Process Output: Focused `ps` with `awk`

Challenge: The default `ps` command often outputs a lot of information, making it hard to quickly find specific processes or key details like CPU and memory usage.

The Solution: Use `awk` to filter and format the output of `ps` for exactly what you need.

ps aux | awk '{print $1, $2, $4, $11}'

Why it works: This command pipes the full output of `ps aux` to `awk`, which then selects and prints only specific columns: User (1), PID (2), %CPU (4), and Command (11). You can easily customize these column numbers for your needs.

Pro-Tip: To find processes consuming more than a certain percentage of CPU, you can add a condition: ps aux | awk '$4 > 10.0 {print $1, $2, $4, $11}' (this example shows processes using more than 10% CPU).

Linux Tips & Tricks | © ngelinux.com | 5/10/2026

0 0 votes
Article Rating
Exit mobile version