Effortless Process Monitoring with `ps` and `awk`
Quick Tip
Effortless Process Monitoring with `ps` and `awk`
Challenge: When dealing with a large number of running processes, it’s often difficult to quickly extract specific information or identify processes based on custom criteria using the standard `ps` command alone.
The Solution: Leverage the power of `awk` to filter and format `ps` command output for precise process monitoring.
ps aux | awk '$1 == "root" { print $2, $11 }'
Why it works: This command pipes the output of `ps aux` (which provides a comprehensive snapshot of running processes) to `awk`. `awk` then processes each line, filtering for lines where the first column (`$1`, the user) is exactly “root”, and prints the second column (`$2`, the PID) and the eleventh column (`$11`, the command name).
Pro-Tip: To quickly find all processes belonging to your current user, use ps aux | awk -v user="$(whoami)" '$1 == user { print $2, $11 }'.
Linux Tips & Tricks | © ngelinux.com | 6/3/2026
