Taming `ps` Output with `awk` for Focused Process Info
Quick Tip
Taming `ps` Output with `awk` for Focused Process Info
Challenge: The output of the `ps` command can be incredibly verbose, making it difficult to quickly find specific process information like CPU usage, memory consumption, or the command itself.
The Solution: Combine `ps` with `awk` to filter and format the output, allowing you to extract exactly what you need.
ps aux | awk '{print $1, $3, $4, $11}'
Why it works: This command uses `ps aux` to display all processes with user, CPU, and memory details. `awk` then processes this output line by line, printing only the specified columns: user, %CPU, %MEM, and the command name.
Pro-Tip: To sort processes by CPU usage, pipe the output to `sort -rnk3` (for descending numeric order on the 3rd column): ps aux | awk '{print $1, $3, $4, $11}' | sort -rnk3
Linux Tips & Tricks | © ngelinux.com | 5/9/2026
