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 be overwhelming, showing far more information than you might need. Extracting specific details like the process ID (PID), command name, and CPU usage can be tedious.
The Solution: Leverage the power of awk to filter and format the ps output for precisely the information you need.
ps aux | awk '{print $2, $11, $3}'
Why it works: ps aux provides a comprehensive snapshot of running processes. awk then processes this output line by line, printing specific fields: $2 for the PID, $11 for the command name, and $3 for the CPU percentage, effectively creating a concise, relevant list.
Pro-Tip: To also include the user running the process, add $1 to the awk print statement: ps aux | awk '{print $1, $2, $11, $3}'
Linux Tips & Tricks | © ngelinux.com | 7/4/2026
