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

Quick Tip

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

Challenge: The output of the ps aux command can be overwhelming, making it difficult to find specific information about running processes quickly.

The Solution: Use awk to filter and format the ps output to display only the columns you need.

ps aux | awk '{print $1 "\t" $2 "\t" $11}'

Why it works: awk processes the output line by line, treating each field (separated by whitespace by default) as a separate item. We then specify which fields (columns) to print, in this case, the user (1), PID (2), and command (11), separated by tabs for readability.

Pro-Tip: To sort the output by CPU usage (descending), pipe the output to sort -rnk3 (assuming CPU% is the 3rd column after filtering).

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted