Taming `ps` Output: Focused Process Info with `awk`
Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The default output of the `ps` command can be overwhelming, showing too much information about processes. Often, you only need specific details like the PID, command, and CPU/memory usage.
The Solution: Combine `ps` with `awk` to filter and format the output to show exactly what you need.
ps aux | awk '{print $2, $11, $4, $3}'
Why it works: `ps aux` provides a comprehensive list of running processes. `awk` then processes each line, printing only the specified columns: PID (column 2), command (column 11), CPU usage (column 4), and memory usage (column 3). You can adjust the column numbers to display different information.
Pro-Tip: To sort the output by memory usage (descending), pipe it to `sort -rnk 3` (assuming memory is the 3rd column in your `awk` output).
Linux Tips & Tricks | © ngelinux.com | 5/10/2026
