Quick Tip
Tame Your Processes: Focused `ps` Output with `awk`
Challenge: The output of the ps aux command can be overwhelmingly verbose when you’re trying to find specific process information like PID, user, or CPU usage.
The Solution: Leverage awk to filter and format the output of ps to display only the information you need.
ps aux | awk '{print $2, $1, $3, $4, $11}'
Why it works: awk is a powerful text-processing tool that can parse lines into fields. By specifying the field numbers (e.g., $2 for PID, $1 for User, $3 for %CPU, $4 for %MEM, $11 for Command), we can create a concise and targeted output of the ps aux command.
Pro-Tip: To see only processes owned by a specific user, add a condition: ps aux | awk -v user="your_username" '$1 == user {print $2, $1, $3, $4, $11}'
Linux Tips & Tricks | © ngelinux.com | 6/27/2026
