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

Quick Tip

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

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

Challenge: The output of the ps command can be overwhelmingly verbose, making it difficult to quickly find specific information about running processes. You often need to sift through many columns to locate details like CPU usage, memory consumption, or the full command line.

The Solution: Combine the power of ps with awk to filter and format the output, displaying only the columns you need.

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

Why it works: ps aux lists all processes with detailed information. awk '{print $1, $2, $4, $11}' then processes this output line by line, printing only the first, second, fourth, and eleventh fields, which typically correspond to USER, PID, %CPU, and COMMAND respectively. You can easily adjust the column numbers to suit your specific needs.

Pro-Tip: Use ps -eo pid,ppid,cmd,%cpu,%mem --sort=-%cpu | head -n 10 to see the top 10 CPU-consuming processes.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted