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

Quick Tip

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

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

The Solution: Combine `ps` with `awk` to filter and display only the columns you need.

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

Why it works: `ps aux` provides a comprehensive snapshot of running processes. `awk` then processes this output line by line, printing only the specified fields (column numbers 2 for PID, 3 for CPU%, 4 for MEM%, and 11 for the command name in this common `ps aux` output format). You can adjust the column numbers based on your `ps` output.

Pro-Tip: Use `ps -eo pid,pcpu,comm` for a more direct, pre-formatted output if you only need PID, CPU usage, and command name.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments