Tame Your Processes: Focused `ps` Output with `awk`
Quick Tip
Tame Your Processes: Focused `ps` Output with `awk`
Challenge: The output of the ps aux command can be overwhelming, making it difficult to quickly find specific process information like CPU or memory usage for a particular application.
The Solution: Leverage awk to filter and format the output of ps for targeted process monitoring.
ps aux | awk '$11 ~ /your_process_name/ { print $2, $4, $6, $11 }'
Why it works: This command pipes the full output of ps aux to awk. awk then filters lines where the 11th field (the command name) matches “your_process_name” and prints specific columns: PID ($2), %CPU ($4), %MEM ($6), and the command name ($11).
Pro-Tip: Use ps -eo pid,ppid,cmd,%cpu,%mem --sort=-%cpu | head -n 10 to quickly see the top 10 CPU-consuming processes.
Linux Tips & Tricks | © ngelinux.com | 6/15/2026
