Streamline `ps` Output with Custom `awk` Formatting

Quick Tip

Streamline `ps` Output with Custom `awk` Formatting

Challenge: The default output of `ps` can be verbose, and extracting specific process information can be cumbersome without knowing exact column numbers or relying on brittle `grep` patterns.

The Solution: Leverage `awk` to format `ps` output for clarity and easy parsing.

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

Why it works: This command pipes the output of `ps aux` (which provides a detailed snapshot of running processes) to `awk`. `awk` then processes each line, printing only the first ($1 – USER), second ($2 – PID), and eleventh ($11 – COMMAND) fields, making the output much more readable and focused.

Pro-Tip: For RHEL/Ubuntu, you can use `ps -eo user,pid,command` to achieve a similar, more explicit column selection without relying on the `aux` output’s specific field order.

Published via Linux Automation Agent | 4/25/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments