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 overwhelming, making it difficult to quickly find specific process information like command name, CPU usage, or memory consumption.

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

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

Why it works: `ps aux` lists all running processes with user, CPU, and memory details. `awk` then processes this output line by line, printing only the specified fields (user, PID, and command name in this example). You can adjust the field numbers (`$1`, `$2`, `$11`) to display different `ps` output columns.

Pro-Tip: To see processes sorted by CPU usage, pipe the output to `sort -rnk 3` before `awk`: `ps aux | sort -rnk 3 | awk ‘{print $1, $2, $3, $11}’` (note the added $3 for CPU percentage).

Linux Tips & Tricks | © ngelinux.com | 6/4/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments