Tame Your `ps` Output: Focused Process Info with `awk`

Quick Tip

Tame Your `ps` Output: Focused Process Info with `awk`

Challenge: The output of the ps command can be overwhelmingly verbose, making it difficult to quickly find the specific information you need about running processes. You often need to sift through many columns just to see a process’s PID, user, or command name.

The Solution: Use awk to filter and display only the columns you care about from the ps command’s output.

ps aux | awk '{print $1, $2, $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 processes each line, printing only the first (USER), second (PID), fourth (STAT), and eleventh (COMMAND) fields, effectively creating a more concise and readable process listing.

Pro-Tip: You can easily customize the column numbers ($1, $2, etc.) in the awk command to display any of the available fields from the ps output. Use ps aux | head -n 1 to see the header row and identify the column numbers you need.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted