Tame Your `ps` Output: Focused Process Info with `awk`
Quick Tip
Tame Your `ps` Output: Focused Process Info with `awk`
Challenge: The output of the `ps` command can be verbose and overwhelming when you’re trying to find specific process information. Often, you only need a few key details like PID, command name, and CPU usage.
The Solution: Use `awk` to filter and format the `ps` output for clarity.
ps aux | awk 'NR==1 || /your_process_name/ {print $2, $11, $3}'
Why it works: This command first lists all processes (`ps aux`) and then pipes the output to `awk`. `awk` prints the second field (PID), the eleventh field (COMMAND), and the third field (CPU %) only for the header line (`NR==1`) or lines containing “your_process_name”.
Pro-Tip: Replace `your_process_name` with a more specific string related to the process you’re looking for, or use a different combination of fields from `ps aux` output for tailored information.
Linux Tips & Tricks | © ngelinux.com | 5/12/2026
