Tame Your Processes: Focused `ps` Output with `awk`
Quick Tip
Tame Your Processes: Focused `ps` Output with `awk`
Challenge: The output of the `ps aux` command can be overwhelming, often displaying more information than you need to quickly identify specific processes or their resource usage.
The Solution: Combine the `ps` command with `awk` to filter and format the output for clarity.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: `awk` processes the output line by line and allows you to select specific columns (fields). In this case, we’re printing the USER, PID, %CPU, %MEM, and COMMAND columns, which are often the most relevant for quick process inspection.
Pro-Tip: To sort processes by CPU usage (descending), you can pipe the output to `sort -rnk3` (replace `3` with the column number for CPU usage if you change the `awk` script).
Linux Tips & Tricks | © ngelinux.com | 6/19/2026
