Quick Tip
Tame Your Processes: Focused `ps` Output with `awk`
Challenge: The default output of the ps command can be overwhelmingly verbose, making it difficult to quickly find specific information about running processes. You need a way to filter and display only the essential details.
The Solution: Combine the power of ps with awk to extract and format only the columns you need, such as PID, user, CPU usage, and command name.
ps aux | awk '{print $2, $1, $3, $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 (PID, USER, %CPU, COMMAND). The numbers correspond to the column position in the ps aux output.
Pro-Tip: Use ps -eo pid,user,%cpu,comm for a more portable and explicit way to select columns if you’re unsure of the exact column numbers, or to avoid issues with varying ps output formats.
Linux Tips & Tricks | © ngelinux.com | 5/31/2026
