Taming `ps` Output: Focused Process Info with `awk`
Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: When listing processes with `ps`, the output can be overwhelmingly verbose. You often need to filter and extract specific information like PID, CPU usage, and command name.
The Solution: Combine `ps` with `awk` to precisely select and format the columns you need.
ps aux | awk '$3 > 5.0 { print $1, $2, $3, $11 }'
Why it works: `ps aux` provides a comprehensive list of running processes. `awk` then filters these lines, printing only those where the CPU usage (the 3rd column, `$3`) is greater than 5.0%. It then prints the specified columns (User, PID, CPU%, Command).
Pro-Tip: Use `ps -eo pid,ppid,cmd,%cpu,%mem –sort=-%cpu | head -n 10` to see the top 10 CPU-consuming processes.
Linux Tips & Tricks | © ngelinux.com | 5/14/2026
