Taming `ps` with `awk` for Focused Process Information

Quick Tip

Taming `ps` with `awk` for Focused Process Information

Challenge: The `ps` command can be overwhelming with a vast amount of process information. Often, you only need specific details like PID, CPU usage, or memory consumption for troubleshooting or monitoring.

The Solution: Pipe the output of `ps` to `awk` to filter and format the exact columns you need.

ps aux | awk '$3 > 5.0 { print $1, $3, $4, $11 }'

Why it works: `ps aux` provides a comprehensive list of running processes. `awk` then iterates through each line, checking if the third column (CPU usage, represented by `$3`) is greater than 5.0%. If it is, it prints specific columns: the username (`$1`), CPU usage (`$3`), memory usage (`$4`), and the command name (`$11`).

Pro-Tip: To see processes sorted by memory usage, use `ps aux –sort=-%mem | head -n 10` to display the top 10 memory-consuming processes.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments