Taming `ps` Output: Focused Process Info with `awk`
Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The output of the `ps` command can be overwhelmingly verbose, making it difficult to quickly find specific information about running processes. Often, you only need a few key details like the PID, command name, and CPU/memory usage.
The Solution: Combine `ps` with `awk` to filter and format the output to display only the essential columns you need.
ps aux | awk '{print $2, $11, $3, $4}'
Why it works: This command uses `ps aux` to list all running processes with detailed information. The `awk` command then processes this output, printing only the fields corresponding to PID (field 2), command name (field 11), CPU percentage (field 3), and memory percentage (field 4). You can easily adjust the field numbers to customize the output further.
Pro-Tip: For even more specific filtering, you can add conditions to your `awk` command, like `ps aux | awk ‘$3 > 5.0 {print $2, $11, $3}’` to show processes using more than 5% CPU.
Linux Tips & Tricks | © ngelinux.com | 5/16/2026
