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

Quick Tip

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

Challenge: The output of the `ps` command can be overwhelmingly verbose, making it difficult to quickly find specific process information like CPU usage, memory consumption, or the full command line.

The Solution: Leverage the power of `awk` to filter and format `ps` output for targeted process monitoring.

ps aux | awk '$1 ~ /root/ { print $1, $2, $11 }'

Why it works: This command pipes the output of `ps aux` (which provides a detailed snapshot of all running processes) to `awk`. `awk` then processes each line, and the condition `$1 ~ /root/` filters for lines where the first field (username) contains “root”. Finally, `{ print $1, $2, $11 }` prints the username, PID, and the command name for those filtered processes.

Pro-Tip: For even more precise filtering, you can specify exact column headers and then use `awk` to match those specific fields, e.g., `ps -eo pid,user,%cpu,comm | awk ‘$3 > 10.0 { print $0 }’` to show processes using more than 10% 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