Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The output of the `ps` command can be overwhelming, filled with columns of information you don’t always need. It’s often difficult to quickly find specific processes or key metrics like CPU and memory usage.
The Solution: Use `awk` to filter and format the `ps` output, showing only the columns you care about.
ps aux | awk '{print $1, $2, $4, $11}'
Why it works: This command pipes the full output of `ps aux` (showing all processes for all users) to `awk`. `awk` then processes each line, printing only the 1st (USER), 2nd (PID), 4th ( %CPU), and 11th (COMMAND) fields. You can easily adjust these field numbers to customize the output.
Pro-Tip: For a more dynamic and real-time view, combine this with `watch`: watch -n 2 'ps aux | awk "{print \$1, \$2, \$4, \$11}"'. The `\` before the `$` is important to prevent `watch` from interpreting them prematurely.
Linux Tips & Tricks | © ngelinux.com | 5/31/2026
