Tame `ps` Output: Focused Process Info with `awk`
Quick Tip
Tame `ps` Output: Focused Process Info with `awk`
Challenge: The output of the `ps` command can be overwhelming, often displaying more information than you need when trying to quickly identify specific processes or their resource usage.
The Solution: Combine `ps` with `awk` to precisely filter and format the process information you’re interested in.
ps aux | awk '/[p]ython/{print $1, $2, $11}'
Why it works: This command lists all processes (`ps aux`), then pipes the output to `awk`. `awk` filters lines containing “python” (the `[p]ython` pattern is a common trick to avoid matching `grep` itself if you were searching for that) and prints specific columns: the user ID (column 1), PID (column 2), and the command name (column 11).
Pro-Tip: Use `ps -eo pid,ppid,cmd,%cpu,%mem –sort=-%cpu | head` to see the top CPU-consuming processes.
Linux Tips & Tricks | © ngelinux.com | 5/14/2026
