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

Quick Tip

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

Challenge: The default output of the ps command can be overwhelming, displaying a lot of information that isn’t immediately relevant when you’re trying to track specific processes or resource usage.

The Solution: Leverage the power of awk to filter and format the ps output, showing only the essential columns you need.

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

Why it works: This command pipes the output of ps aux (which shows all processes with user, CPU, and memory usage) to awk. awk then selects and prints only the first, second, fourth, and eleventh fields, which typically correspond to USER, PID, %CPU, and COMMAND respectively. This provides a concise, focused view of your running processes.

Pro-Tip: To sort this output by CPU usage (column 3), you can pipe it to sort -k3nr: ps aux | awk '{print $1, $2, $4, $11}' | sort -k3nr

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