Site icon New Generation Enterprise Linux

Tame Your Processes: Focused `ps` Output with `awk`

Quick Tip

Tame Your Processes: Focused `ps` Output with `awk`

Challenge: The default output of the ps command can be overwhelmingly verbose, making it difficult to quickly find specific process information like PID, CPU usage, or memory consumption.

The Solution: Combine ps with awk to selectively display only the columns you need, providing a much cleaner and more focused view of your running processes.

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

Why it works: ps aux provides a comprehensive list of processes, and awk is used to iterate through each line, printing only the specified fields (user, PID, CPU%, MEM%, and command name in this example). You can easily adjust the numbers in awk to select different columns based on your needs.

Pro-Tip: To filter for a specific process, you can pipe the output to grep before awk, like so: ps aux | grep 'nginx' | awk '{print $2, $3, $4, $11}'

Linux Tips & Tricks | © ngelinux.com | 6/22/2026

0 0 votes
Article Rating
Exit mobile version