Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The output of the ps aux command can be overwhelmingly verbose when you’re trying to find specific process information like CPU usage, memory consumption, or the command itself.
The Solution: Use awk to filter and format the ps aux output to display only the columns you need.
ps aux | awk '{print $2, $3, $4, $11}'
Why it works: awk processes the output line by line, and with '{print $2, $3, $4, $11}', it prints the second (PID), third (CPU%), fourth (MEM%), and eleventh (COMMAND) columns from each line of the ps aux output.
Pro-Tip: To sort the output by CPU usage (descending), pipe the result to sort -rnk 3: ps aux | awk '{print $2, $3, $4, $11}' | sort -rnk 3
Linux Tips & Tricks | © ngelinux.com | 5/18/2026
