Quick Tip
Tame Your Processes: Focused `ps` Output with `awk`
Challenge: The output of the `ps` command can be overwhelming, showing a vast amount of information about running processes. Often, you only need specific details like the process name, PID, and CPU/memory usage.
The Solution: Pipe the output of `ps` to `awk` to precisely select and format the columns you need.
ps aux | awk '{print $2, $4, $11}'
Why it works: `ps aux` provides a detailed, user-oriented snapshot of all processes. `awk` then processes this output line by line, printing only the fields specified by their column number (2 for PID, 4 for CPU%, and 11 for the command name). The default field separator for `awk` is whitespace, which works perfectly with `ps` output.
Pro-Tip: Add the `-o` option to `ps` for even more granular control over the output format directly, e.g., `ps -eo pid,pcpu,comm`.
Linux Tips & Tricks | © ngelinux.com | 6/21/2026
