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

Quick Tip

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

Challenge: The standard `ps` command often dumps a lot of information, making it hard to quickly find specific process details like CPU usage, memory, or the full command line for a particular application.

The Solution: Combine `ps` with `awk` to precisely filter and display only the columns you need.

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

Why it works: `ps aux` provides a comprehensive snapshot of running processes. `awk` then processes this output line by line, filtering for lines containing ‘process_name’ and printing only the specified columns (User, PID, %CPU, %MEM, COMMAND) separated by spaces.

Pro-Tip: To sort processes by CPU usage, pipe the `ps aux` output to `sort -nk 3` before piping to `awk` and use `print $1, $2, $3, $4, $11` (or adjust columns as needed).

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments