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

Quick Tip

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

Challenge: The output of the `ps` command can be overwhelming when you need to quickly find specific process information like CPU or memory usage for a particular user or process name.

The Solution: Combine `ps` with `awk` for precise filtering and display of process information.

ps aux | awk '/[p]rocess_name/ {print $1, $2, $3, $4, $11}'

Why it works: This command pipes the detailed output of `ps aux` to `awk`. `awk` then filters lines containing your specified process name (the `[p]rocess_name` pattern prevents `awk` from matching itself) and prints specific columns (user, PID, %CPU, %MEM, and command name) for a cleaner, more focused view.

Pro-Tip: To sort processes by CPU usage, pipe the output of `ps aux` to `sort -rnk 3` (for descending numeric sort on the 3rd column, %CPU).

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments