Quick Tip
Taming Process Sprawl: Focused `ps` Output with `awk`
Challenge: The output of the ps aux command can be overwhelming, especially on busy systems. It’s often difficult to quickly find specific processes based on criteria like user, CPU usage, or command name.
The Solution: Use awk to filter and format the output of ps, allowing you to extract exactly the information you need.
ps aux | awk '/[u]sername/ {print $0}' # Example: Filter by username ps aux | awk '$3 > 10.0 {print $0}' # Example: Filter by CPU usage > 10% ps aux | awk '/[c]ommand_name/ {print $0}' # Example: Filter by command name
Why it works: awk is a powerful pattern scanning and processing language. By piping the output of ps to awk, you can apply conditional logic to each line (record) and print only the fields (columns) that match your criteria.
Pro-Tip: Combine multiple awk conditions with && (AND) or || (OR) for more complex filtering. For example, to find processes by a user using more than 5% CPU: ps aux | awk '$1 == "username" && $3 > 5.0 {print $0}'
Linux Tips & Tricks | © ngelinux.com | 6/17/2026
