Tame Your Processes: Efficient `ps` Output with `awk`
Quick Tip
Tame Your Processes: Efficient `ps` Output with `awk`
Challenge: The default output of the `ps` command can be overwhelming, showing far more information than you might need for quick process inspection. You want to filter and display only specific process details efficiently.
The Solution: Leverage `awk` to parse and display only the desired columns from the `ps` command.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: The `ps aux` command provides a comprehensive snapshot of running processes. `awk` then acts as a powerful text processor, allowing you to specify exactly which columns (fields) to print from the output. In this example, we’re selecting the user, PID, CPU%, MEM%, and the command name.
Pro-Tip: To display only the PID and command name, use: ps aux | awk '{print $2, $11}'
Linux Tips & Tricks | © ngelinux.com | 5/17/2026
