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

Quick Tip

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

Challenge: When listing processes with `ps`, the output can be overwhelmingly verbose. You often need to filter and display specific columns to quickly find the information you’re looking for, like PID, CPU usage, or command name.

The Solution: Combine `ps` with `awk` to select and format specific process information.

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

Why it works: The `ps aux` command provides a comprehensive list of running processes. `awk` then processes this output line by line, printing only the specified columns (PID, %CPU, %MEM, COMMAND in this example) separated by spaces.

Pro-Tip: To sort processes by CPU usage, pipe the output to `sort -nrk3`.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments