Taming `ps` Output: Focused Process Info with `awk`
Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The output of the ps command can often be overwhelming, showing far more information than you need. It’s difficult to quickly find specific process details like CPU usage or memory consumption for a particular application.
The Solution: Combine ps with awk to filter and display only the columns you’re interested in.
ps aux | awk '{print $1, $2, $4, $11}'
Why it works: ps aux lists all running processes with detailed information. awk then processes this output line by line, printing only the specified fields (column numbers correspond to USER, PID, %CPU, and COMMAND in this example). This allows for precise control over the displayed information.
Pro-Tip: Use ps -eo pid,ppid,cmd,%cpu,%mem --sort=-%cpu | head to quickly see the top CPU-consuming processes.
Linux Tips & Tricks | © ngelinux.com | 5/20/2026
