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 verbose and difficult to parse when you need to quickly find specific information about running processes. Often, you’re only interested in a few key details like the PID, command name, and CPU usage.
The Solution: Leverage the power of awk to filter and format the output of ps for precisely the columns you need.
ps aux | awk '{print $1, $2, $4, $11}'
Why it works: This command pipes the output of ps aux (which shows all processes for all users with detailed information) to awk. awk then processes each line and prints only the 1st (USER), 2nd (PID), 4th (%CPU), and 11th (COMMAND) fields, effectively creating a cleaner, more targeted view of process information.
Pro-Tip: To find processes using a specific command, you can add another awk filter or use grep: ps aux | awk '{print $1, $2, $4, $11}' | grep "your_command_name"
Linux Tips & Tricks | © ngelinux.com | 6/2/2026
