Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The default output of the `ps` command can be overwhelming, especially on busy systems, making it difficult to quickly find specific process information like PID, CPU usage, or memory consumption.
The Solution: Combine `ps` with `awk` to filter and format the output precisely to your needs.
ps aux | awk '$1 ~ /root/ {print $2, $11}'
Why it works: This command lists all processes (`ps aux`), then pipes the output to `awk`. `awk` filters lines where the first field (`$1`, the user) matches “root” (`/root/`) and then prints the second field (`$2`, the PID) and the eleventh field (`$11`, the command name).
Pro-Tip: For a more human-readable output, use `ps -eo pid,user,%cpu,%mem,comm` to select specific columns directly.
Linux Tips & Tricks | © ngelinux.com | 5/16/2026
