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 often be overwhelmingly verbose, making it difficult to quickly find specific process information like PID, CPU usage, or memory consumption.
The Solution: Combine `ps` with `awk` to precisely select and format the columns you need.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: `ps aux` provides a comprehensive list of running processes. `awk` then processes this output line by line, printing only the specified fields (user, PID, CPU%, MEM%, and command name in this example). You can customize the numbers to display any column from the `ps` output.
Pro-Tip: Use `ps -eo pid,ppid,cmd,%cpu,%mem –sort=-%cpu` to list processes sorted by CPU usage, then pipe to `awk` for even more targeted viewing.
Linux Tips & Tricks | © ngelinux.com | 5/25/2026
