Master `ps` Output: Focused Process Info with `awk`

Quick Tip

Master `ps` Output: Focused Process Info with `awk`

Challenge: The output of the `ps` command can be verbose and difficult to sift through when you need specific process information, like the PID and command name.

The Solution: Pipe the output of `ps` to `awk` to filter and format it precisely.

ps aux | awk '/nginx/ {print $2, $11}'

Why it works: `ps aux` lists all processes in a detailed format. `awk ‘/nginx/ {print $2, $11}’` then filters these lines to only show those containing “nginx” and prints the second column (PID) and the eleventh column (command name).

Pro-Tip: Use `ps -ef | grep your_process_name | grep -v grep` for a similar but slightly different approach to filtering.

Linux Tips & Tricks | © ngelinux.com | 5/12/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments