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 verbose and difficult to parse when you’re looking for specific process information like PID, CPU usage, or memory consumption. Manually sifting through lines of text is inefficient.

The Solution: Combine `ps` with `awk` to selectively display and format the exact columns you need.

ps aux | awk '{print $2, $3, $4, $11}'

Why it works: `ps aux` provides a comprehensive snapshot of running processes. `awk` is then used to process this output line by line, and the `{print $2, $3, $4, $11}` part tells `awk` to only print the 2nd (PID), 3rd (CPU%), 4th (MEM%), and 11th (Command Name) columns, creating a clean and focused view.

Pro-Tip: Use `ps -eo pid,pcpu,pmem,comm` for a similar effect with built-in `ps` formatting options.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments