Master `ps` Output with Custom `awk` Formatting

Quick Tip

Master `ps` Output with Custom `awk` Formatting

Challenge: The default output of the ps command can be verbose and difficult to parse for specific information like CPU usage, memory, or command name.

The Solution: Leverage awk to filter and format the output of ps for precisely the information you need.

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

Why it works: This command pipes the output of ps aux (which shows all processes for all users in detail) to awk. awk then selects and prints specific columns (user, PID, %CPU, %MEM, and command) separated by spaces, giving you a clean, customized view.

Pro-Tip: To sort processes by CPU usage in descending order, pipe the output to sort -nrk 3: ps aux | awk '{print $1, $2, $3, $4, $11}' | sort -nrk 3

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments