Quick Tip
Taming `ps` with `awk` for Focused Process Info
Challenge: The standard `ps` command can produce a lot of output, making it difficult to quickly find specific information about processes, like their PIDs or CPU usage.
The Solution: Use `awk` to filter and format the `ps` output for precisely what you need.
ps aux | awk '{print $2, $11, $3}'
Why it works: This command pipes the output of `ps aux` (which shows all processes with user, CPU, and memory details) to `awk`. `awk` then splits each line into fields and prints only the second field (PID), eleventh field (command), and third field (CPU usage), giving you a cleaner, more focused view.
Pro-Tip: To sort the output by CPU usage, pipe it through `sort -k3nr` (e.g., ps aux | awk '{print $2, $11, $3}' | sort -k3nr | head to see the top 10 CPU-consuming processes).
Linux Tips & Tricks | © ngelinux.com | 5/9/2026
