Tame Your Processes: Focused `ps` Output with `awk`
Quick Tip
Tame Your Processes: Focused `ps` Output with `awk`
Challenge: The output of the `ps` command can be overwhelmingly verbose, making it difficult to quickly find specific process information like PIDs, user, or CPU usage.
The Solution: Combine `ps` with `awk` to filter and format the output to display only the columns you need.
ps aux | awk '{print $2, $1, $4, $11}'
Why it works: `ps aux` provides a comprehensive list of running processes. `awk` then processes this output line by line, and the `{print $2, $1, $4, $11}` part instructs `awk` to print the 2nd (PID), 1st (USER), 4th (CPU%), and 11th (COMMAND) fields, effectively creating a clean, custom view.
Pro-Tip: You can use `ps -eo pid,user,%cpu,command` as a more direct alternative to `ps aux | awk ‘{print $2, $1, $4, $11}’`.
Linux Tips & Tricks | © ngelinux.com | 5/27/2026
