Site icon New Generation Enterprise Linux

Tame Your `ps` Output with Custom `awk` Formatting

Quick Tip

Tame Your `ps` Output with Custom `awk` Formatting

Challenge: The default output of the ps command can be overwhelming, displaying far more information than you typically need for quick process monitoring.

The Solution: Use awk to selectively display only the columns you’re interested in, making process inspection much more efficient.

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

Why it works: awk processes the output of ps aux line by line, and the ‘{print $1, $2, $4, $11}’ part tells it to only print the 1st, 2nd, 4th, and 11th columns, which typically correspond to USER, PID, %CPU, and COMMAND respectively.

Pro-Tip: You can customize the column numbers ($1, $2, etc.) to display any information available in the ‘ps aux’ output. For instance, to also see %MEM, use: ps aux | awk '{print $1, $2, $4, $5, $11}'

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

0 0 votes
Article Rating
Exit mobile version