Quick Tip
Taming `ps` with `awk` for Focused Process Info
Challenge: The output of the `ps` command can be verbose, making it difficult to quickly find specific process information like PID, user, or CPU usage.
The Solution: Leverage `awk` to filter and reformat the `ps` output for exactly what you need.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: `ps aux` provides a comprehensive snapshot of running processes. `awk` then processes each line, printing only the specified fields (username, PID, CPU%, MEM%, and command name), effectively creating a cleaner, more focused view.
Pro-Tip: To sort by CPU usage (descending), pipe the output to `sort -rnk3` (replace `3` with the appropriate column number for CPU%). For example: ps aux | awk '{print $1, $2, $3, $4, $11}' | sort -rnk3
Linux Tips & Tricks | © ngelinux.com | 5/10/2026
