Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The output of the `ps` command can be very verbose, making it difficult to quickly find specific information about running processes, such as their PID, CPU usage, or memory consumption.
The Solution: Pipe the output of `ps` to `awk` to filter and format the output.
ps aux | awk '{print $2, $3, $4, $11}'
Why it works: `awk` processes the output line by line and allows you to specify which fields (columns) to print. In this example, `$2` is the PID, `$3` is CPU usage, `$4` is memory usage, and `$11` is the command name. You can adjust the field numbers to display any information you need.
Pro-Tip: Use `ps -eo pid,pcpu,pmem,comm` for a more human-readable and pre-formatted output that can also be piped to `awk`.
Linux Tips & Tricks | © ngelinux.com | 5/16/2026
