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

Quick Tip

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

Challenge: The standard `ps` command can be overly verbose, making it difficult to quickly find specific process information like CPU usage, memory consumption, or command name for a particular user or process ID.

The Solution: Combine `ps` with `awk` for precise output filtering and formatting.

ps aux | awk '$1 == "your_username" { print $2, $4, $11 }'

Why it works: `ps aux` lists all running processes with detailed information. `awk` then processes this output line by line, using `$1` for the username, `$2` for the PID, `$4` for CPU percentage, and `$11` for the command. The condition `$1 == “your_username”` filters for processes owned by a specific user, and `{ print $2, $4, $11 }` prints only the PID, CPU%, and command name for those matching processes.

Pro-Tip: To find processes using a specific amount of memory (e.g., > 10% memory usage), you can modify the awk command: ps aux | awk '$4 > 10 { print $2, $4, $11 }'

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted