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 overwhelming, especially on busy systems. Extracting specific process information like PID, command, and CPU usage can be tedious and error-prone with manual parsing.

The Solution: Leverage the power of awk to precisely filter and format the output of ps for a clear, actionable view.

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

Why it works: This command pipes the verbose output of ps aux to awk. awk then processes each line, printing the second field (PID), the eleventh field (command name), and the third field (CPU usage percentage) separated by spaces. This provides a concise summary of key process metrics.

Pro-Tip: To include all processes and sort by CPU usage, try: ps aux --sort=-%cpu | awk '{print $2, $11, $3}' | head -n 10

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments