Tame Your Processes: Focused `ps` Output with `awk`
Quick Tip
Tame Your Processes: Focused `ps` Output with `awk`
Challenge: The output of the ps command can be overwhelming, filled with information you don’t always need. Extracting specific details about running processes efficiently can be time-consuming.
The Solution: Combine the power of ps with awk to filter and format process information precisely.
ps aux | awk '$1 == "your_user" { print $2, $11 }'
Why it works: ps aux lists all running processes with user information. awk then processes this output line by line. The condition '$1 == "your_user"' filters for processes owned by ‘your_user’, and '{ print $2, $11 }' prints the Process ID (PID) and the command name (which is often the 11th field).
Pro-Tip: Use ps -eo pid,comm,user,pcpu,pmem | awk 'NR==1 || $4 > 5.0 { print }' to see processes using more than 5% CPU, along with their PID, command, user, and resource usage. (NR==1 keeps the header line).
Linux Tips & Tricks | © ngelinux.com | 6/27/2026
