Quick Tip
Tame Your `ps` Output: Focused Process Info with `awk`
Challenge: The output of the `ps` command can be overwhelmingly verbose when you’re trying to find specific process information. Piping it to `grep` is common, but `awk` offers more precise control over what you see.
The Solution: Use `awk` to filter and format the `ps` output, displaying only the columns you need.
ps aux | awk '/nginx/ { print $1, $2, $11 }'
Why it works: `ps aux` provides a comprehensive list of processes. `awk` then processes this output line by line. The pattern `/nginx/` filters for lines containing “nginx”, and `{ print $1, $2, $11 }` extracts and prints the User, PID, and Command columns, respectively.
Pro-Tip: You can use `ps -eo user,pid,cmd` for a more column-controlled base output, and then pipe it to `awk` for further filtering.
Linux Tips & Tricks | © ngelinux.com | 5/17/2026
