Tame Your `ps` Output: Focused Process Info with `awk`
Quick Tip
Tame Your `ps` Output: Focused Process Info with `awk`
Challenge: The output of the `ps` command can often be overwhelming, especially on busy systems, making it difficult to quickly find the information you need about specific processes.
The Solution: Leverage `awk` with `ps` to filter and format the output to show only the columns and processes you care about.
ps aux | awk '/nginx/ {print $1, $2, $11}'
Why it works: This command first lists all processes (`ps aux`) and then pipes the output to `awk`. `awk` then filters lines containing “nginx” and prints only the username (column 1), PID (column 2), and the command name (column 11) for those lines, giving you a clean, targeted view.
Pro-Tip: Use `grep -v` in conjunction with `awk` to exclude processes, e.g., `ps aux | grep [a]llow | awk ‘{print $1, $11}’` to exclude the `grep` process itself.
Linux Tips & Tricks | © ngelinux.com | 5/12/2026
