Taming Process Sprawl: Focused `ps` Output with `awk`
Quick Tip
Taming Process Sprawl: Focused `ps` Output with `awk`
Challenge: The output of the `ps` command can be overwhelming when you’re trying to find specific information about running processes, especially on busy systems. You might want to see only certain columns or filter based on process names.
The Solution: Combine the power of `ps` with `awk` to select and format specific process information.
ps aux | awk '/my_process_name/ { print $1, $2, $4, $11 }'
Why it works: `ps aux` lists all running processes with user-oriented, detailed output. `awk` then filters this output line by line, and the `/my_process_name/` part acts as a pattern to select only lines containing “my_process_name”. Finally, `{ print $1, $2, $4, $11 }` selects and prints specific columns (User, PID, %CPU, Command) from the matching lines.
Pro-Tip: To get a sorted list of the top 10 CPU-consuming processes, you can use: ps aux --sort=-%cpu | head -n 11 (the extra 1 is for the header line).
Linux Tips & Tricks | © ngelinux.com | 6/6/2026
