Taming Process Monitoring: Focused `ps` Output with `awk`
Quick Tip
Taming Process Monitoring: Focused `ps` Output with `awk`
Challenge: The standard `ps` command often outputs a wealth of information, making it difficult to quickly find specific details about running processes, such as CPU usage, memory consumption, or command arguments for a particular service.
The Solution: Combine `ps` with `awk` to filter and display only the columns you need. For instance, to see the PID, CPU usage (`%CPU`), and command for all processes, you can use:
ps aux | awk '{print $1, $3, $11}'
Why it works: `ps aux` lists all running processes in a user-friendly format, and `awk` is a powerful text-processing tool that can select and reformat specific fields (columns) from its input, allowing you to create a concise, customized view of process information.
Pro-Tip: To see only processes related to ‘nginx’, you can pipe the output to ‘grep’: ps aux | grep nginx | awk '{print $1, $3, $11}'.
Linux Tips & Tricks | © ngelinux.com | 5/21/2026
