Taming Process Sprawl: Focused `ps` Output with `awk`

Quick Tip

Taming Process Sprawl: Focused `ps` Output with `awk`

Challenge: The output of the ps command can be overwhelming when you’re trying to find specific information about running processes. Filtering and extracting just the data you need can be cumbersome.

The Solution: Combine ps with awk for precise process information filtering.

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

Why it works: This command pipes the output of ps aux (which shows all processes with user, CPU, memory, etc.) to awk. awk '{print $2, $11}' then specifically extracts the second column (PID) and the eleventh column (command name) from each line of the output, giving you a clean, focused list.

Pro-Tip: To filter by a specific command name, you can add a condition to awk: ps aux | awk '/nginx/ {print $2, $11}'

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted