Streamline `ps` Output with Custom `awk` Formatting

Quick Tip

Streamline `ps` Output with Custom `awk` Formatting

Challenge: The standard output of the ps command can be overwhelming, often displaying more information than necessary, making it difficult to quickly identify specific processes or their resource usage.

The Solution: Leverage awk to parse and filter the output of ps, displaying only the columns you need.

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

Why it works: This command pipes the output of ps aux (showing all processes with user, CPU, and memory usage) to awk. awk then prints specific fields: the user ($1), PID ($2), %CPU ($4), and command ($11), effectively creating a cleaner, more focused output.

Pro-Tip: You can customize the columns by changing the numbers after the ‘$’ sign in the awk command to match other fields you’re interested in. For example, ps aux | awk '{print $1, $2, $5, $11}' would show %MEM instead of %CPU.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments