Taming `ps` Output with Custom `awk` Formatting

Quick Tip

Taming `ps` Output with Custom `awk` Formatting

Challenge: The standard output of the `ps` command can be overwhelming, especially when you’re trying to quickly identify specific processes by user, CPU usage, or memory consumption.

The Solution: Leverage `awk` to filter and format the `ps` output for clarity.

ps aux | awk '$1 == "your_user" && $4 > 5.0 { print $2, $11, $4 "%" }'

Why it works: This command first lists all processes (`ps aux`). Then, `awk` filters for processes owned by “your_user” (column 1) where the %CPU usage (column 4) is greater than 5.0. It then prints the PID (column 2), command name (column 11), and the CPU percentage.

Pro-Tip: You can easily adapt the `$1 == “your_user”` and `$4 > 5.0` conditions to filter by other criteria like memory usage (`$6` for %MEM) or process name.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments