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 when you’re looking for specific process information, like the CPU and memory usage of a particular process name.
The Solution: Combine `ps` with `awk` to filter and format the output for clarity.
ps aux | awk '/process_name/ {print $2, $3, $4, $11}'
Why it works: This command pipes the full output of `ps aux` to `awk`. `awk` then filters lines containing “process_name” and prints specific columns: PID ($2), %CPU ($3), %MEM ($4), and the command name ($11).
Pro-Tip: Use `ps -eo pid,pcpu,pmem,comm` for a more direct way to get these specific columns if your `ps` version supports it.
Linux Tips & Tricks | © ngelinux.com | 5/31/2026
