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

Quick Tip

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

Challenge: The standard `ps` command often outputs a lot of information, making it difficult to quickly find specific details about running processes. You might want to see only certain fields like PID, User, and CPU usage.

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

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

Why it works: `ps aux` provides a detailed snapshot of all running processes. `awk` then processes this output line by line, and `{print $1, $2, $3, $4, $11}` explicitly prints the fields corresponding to User, PID, %CPU, %MEM, and the Command, respectively. Adjust the `$N` numbers based on the output of `ps aux` to select your desired columns.

Pro-Tip: Use `ps -eo pid,user,%cpu,%mem,cmd` for a more direct way to select specific columns without needing `awk` if you know the exact field names you want.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted