Master `ps` Output with `awk` for Focused Process Info
Quick Tip
Master `ps` Output with `awk` for Focused Process Info
TITLE: Master `ps` Output with `awk` for Focused Process Info
Challenge: The default `ps aux` output can be overwhelming, making it difficult to quickly find specific information about running processes, especially when dealing with many machines or complex environments.
The Solution: Leverage the power of `awk` to filter and format `ps` output for precisely the information you need.
ps aux | awk '$1=="root" && $11 ~ /nginx/ {print $2, $11, $12}'
Why it works: This `awk` command filters processes owned by ‘root’ (`$1==”root”`) and whose command name (starting from the 11th field) contains “nginx” (`$11 ~ /nginx/`). It then prints the Process ID (`$2`), the command name (`$11`), and its arguments (`$12`).
Pro-Tip: Use `ps -eo pid,user,cmd | grep “your_process_name”` for a quick filter without needing to count fields, or `ps aux | grep “your_process_name”` for a more general search.
Linux Tips & Tricks | © ngelinux.com | 6/22/2026
