Tame Process Sprawl: Focused `ps` Output with `awk`
Quick Tip
Tame Process Sprawl: Focused `ps` Output with `awk`
Challenge: The output of the `ps` command can be overwhelming, making it difficult to quickly find specific process information like PID, command name, or CPU/memory usage.
The Solution: Leverage `awk` to filter and format the `ps` output for targeted process monitoring.
ps aux | awk '/nginx/ {print $2, $11}'
Why it works: This command pipes the full `ps aux` output to `awk`. `awk` then filters lines containing “nginx” (the process name you’re looking for) and prints only the second field (PID) and the eleventh field (command name).
Pro-Tip: Combine this with `grep -v grep` to exclude the `grep` process itself from your results: ps aux | grep 'nginx' | grep -v grep | awk '{print $2, $11}'
Linux Tips & Tricks | © ngelinux.com | 6/19/2026
