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 overwhelming, displaying a lot of information about running processes that you might not need. This makes it difficult to quickly find specific process details.
The Solution: Leverage the power of `awk` to filter and format the `ps` command’s output, allowing you to display only the columns you’re interested in.
ps aux | awk '{print $1, $2, $11}'
Why it works: This command pipes the output of `ps aux` (which shows all processes with detailed information) to `awk`. `awk` then processes each line, printing only the first ($1), second ($2), and eleventh ($11) fields, which typically correspond to the USER, PID, and COMMAND respectively. You can adjust the field numbers to display any columns you need.
Pro-Tip: To see more detailed process information without overwhelming output, try a combination like: ps -eo pid,ppid,cmd,%cpu,%mem --sort=-%cpu | head -n 10 to see the top 10 CPU-consuming processes.
Linux Tips & Tricks | © ngelinux.com | 6/4/2026
