Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The output of the `ps` command can be overwhelming, especially when you’re trying to find specific information about processes like their CPU or memory usage. You often have to sift through many columns of irrelevant data.
The Solution: Combine `ps` with `awk` to precisely select and display only the columns you need.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: `awk` is a powerful text-processing tool that can split input lines into fields (columns) and then print specific fields. In this case, `ps aux` provides detailed process information, and `awk` is instructed to print the username (field 1), PID (field 2), CPU usage (field 3), memory usage (field 4), and the command name (field 11).
Pro-Tip: Use `ps ef` for a tree-like process hierarchy and adjust the field numbers in `awk` accordingly to extract information from that format.
Linux Tips & Tricks | © ngelinux.com | 5/21/2026
