Site icon New Generation Enterprise Linux

Taming `ps` Output with Custom `awk` Formatting

Quick Tip

Taming `ps` Output with Custom `awk` Formatting

Challenge: The default output of the ps command can be verbose and difficult to parse for specific process information, making it hard to quickly find what you need.

The Solution: Leverage awk to filter and reformat the output of ps for targeted information retrieval.

ps aux | awk '$3 > 10.0 { print $1, $3, $11 }'

Why it works: This command uses ps aux to get a comprehensive list of processes, then pipes it to awk. awk '$3 > 10.0 { print $1, $3, $11 }' filters for processes where the CPU usage (field 3) is greater than 10.0% and then prints the User (field 1), CPU % (field 3), and the Command (field 11).

Pro-Tip: You can customize the fields printed by awk to display exactly the information you need, such as memory usage (field 4) or process ID (field 2).

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

0 0 votes
Article Rating
Exit mobile version