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

Quick Tip

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

Challenge: The output of the `ps` command can be overwhelming, especially on busy systems. It’s often difficult to quickly find specific process information like CPU usage or memory consumption in a clear, human-readable format.

The Solution: Combine `ps` with `awk` to filter and format process information for immediate insight.

ps aux | awk 'NR==1 || $11 ~ /your_process_name/ { print $0 }'

Why it works: `ps aux` provides a comprehensive list of processes. `awk` then filters this output. `NR==1` ensures the header is always included, and `$11 ~ /your_process_name/` filters for lines where the eleventh field (typically the command name) matches your desired process. You can customize the fields printed by `awk` to include specific metrics like CPU (`%CPU`) or memory (`%MEM`).

Pro-Tip: To see just the PID and command name of a process, use ps aux | awk '/your_process_name/ { print $2, $11 }'.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted