Taming `ps` Output: Focused Process Info with `awk`
Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The standard `ps` command often outputs a lot of information about running processes, making it difficult to quickly find specific details like CPU or memory usage for a particular application.
The Solution: Combine `ps` with `awk` to filter and display only the columns you need, making process monitoring significantly more efficient.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: `ps aux` lists all processes with user, CPU, and memory details. `awk` then processes this output line by line, printing only the specified fields (user, PID, %CPU, %MEM, and command name in this example). You can adjust the column numbers to suit your needs.
Pro-Tip: Use `ps -eo pid,ppid,cmd,%cpu,%mem –sort=-%cpu | head -n 10` to see the top 10 CPU-consuming processes sorted by CPU usage.
Linux Tips & Tricks | © ngelinux.com | 6/5/2026
