Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The default output of the ps command can be verbose, making it difficult to quickly find specific process information like the PID, user, or CPU usage.
The Solution: Combine ps with awk to filter and format the output, displaying only the columns you need.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: This command pipes the output of ps aux (which shows all processes for all users in detailed format) to awk. awk then processes each line, printing specific fields: $1 (USER), $2 (PID), $3 (%CPU), $4 (%MEM), and $11 (COMMAND). You can adjust the numbers to select different columns as needed.
Pro-Tip: Use ps -eo pid,user,%cpu,%mem,command for a more explicit column selection directly within ps itself, avoiding the need for awk if you know the exact column names.
Linux Tips & Tricks | © ngelinux.com | 5/22/2026
