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, making it difficult to find specific process information quickly. You often want to see only certain columns like PID, command name, or CPU usage.
The Solution: Combine `ps` with `awk` to filter and display only the columns you need.
ps aux | awk '{print $1, $2, $11}'
Why it works: `ps aux` provides a comprehensive list of running processes. `awk` then processes this output line by line, printing specific fields (columns) based on their numerical position. In this example, we print the User (column 1), PID (column 2), and the Command (column 11).
Pro-Tip: Use `ps -eo pid,user,cmd,%cpu,%mem –sort=-%cpu` to sort processes by CPU usage and display specific fields directly.
Linux Tips & Tricks | © ngelinux.com | 6/12/2026
