Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The output of the ps command can be verbose, making it difficult to quickly find specific process information like PID, CPU usage, or memory consumption.
The Solution: Pipe the output of ps to awk to filter and format the information you need.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: awk processes text line by line and can be instructed to print specific fields. By default, ps aux outputs fields separated by whitespace, and we’re selecting common ones: USER (1), PID (2), %CPU (3), %MEM (4), and COMMAND (11).
Pro-Tip: Use ps -eo pid,pcpu,pmem,comm for a more direct, pre-formatted view without needing awk for common fields.
Linux Tips & Tricks | © ngelinux.com | 6/8/2026
