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

Quick Tip

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

Challenge: The standard `ps` command can produce a lot of information, making it difficult to quickly find specific process details like 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, $3, $4, $11}'

Why it works: `ps aux` lists all running processes with detailed information. `awk` then processes this output line by line, printing only the fields specified by their column number (e.g., $1 for USER, $2 for PID, $3 for %CPU, $4 for %MEM, and $11 for COMMAND).

Pro-Tip: To see processes sorted by CPU usage, pipe the output to `sort -rnk3` (replace `3` with the column number for %CPU if you change the `awk` fields).

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments