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 be overwhelming, especially on busy systems. Extracting specific information like CPU usage, memory, or the full command line for a particular process can be a tedious manual task.

The Solution: Combine `ps` with `awk` for precise, targeted process information.

ps aux | awk '/[p]rocess_name/ {print $0}'

Why it works: `ps aux` provides a comprehensive list of running processes. `awk` then filters this output, using a regular expression (the `[p]` before `process_name` prevents `awk` from matching itself) to find lines containing your target process name. Finally, `{print $0}` prints the entire matching line.

Pro-Tip: To get even more specific, you can print only certain fields. For example, to see just the PID and command name of processes matching “nginx”: ps aux | awk '/[n]ginx/ {print $2, $11}'

Linux Tips & Tricks | © ngelinux.com | 6/2/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments