Tame Your Processes: Focused `ps` Output with `awk`
Quick Tip
Tame Your Processes: Focused `ps` Output with `awk`
Challenge: The `ps` command provides a wealth of information about running processes, but it can be overwhelming and difficult to extract specific details quickly.
The Solution: Pipe the output of `ps` to `awk` to filter and format the information to your exact needs.
ps aux | awk '{print $1, $2, $11}'
Why it works: `awk` allows you to process text line by line and select specific fields (columns). In this example, we select the username (field 1), PID (field 2), and command (field 11) from the `ps aux` output, providing a clean, focused view of essential process information.
Pro-Tip: Use `awk`’s conditional statements to filter processes further. For example, to see only processes run by the user ‘root’: ps aux | awk '$1 == "root" {print $2, $11}'
Linux Tips & Tricks | © ngelinux.com | 7/4/2026
