Master `ps` Output with Custom `awk` Formatting
Quick Tip
Master `ps` Output with Custom `awk` Formatting
Challenge: The default output of the ps command can be overwhelming with too much information, making it difficult to quickly find specific process details like CPU usage, memory consumption, or command names.
The Solution: Leverage awk to filter and format the output of ps to display only the essential columns you need.
ps aux | awk '{print $1, $2, $4, $11}'
Why it works: The ps aux command provides a comprehensive list of running processes. awk '{print $1, $2, $4, $11}' then processes this output line by line, printing only the first (USER), second (PID), fourth (CPU%), and eleventh (COMMAND) fields, giving you a cleaner, more focused view.
Pro-Tip: Customize the fields by changing the numbers within the curly braces. For example, awk '{print $1, $NF}' will show the USER and the very last field (which is usually the COMMAND).
Linux Tips & Tricks | © ngelinux.com | 5/10/2026
