Quick Tip
Taming `ps` Output with Custom `awk` Formatting
Challenge: The default output of the ps command can be verbose and difficult to parse when you need specific process information, like CPU usage, memory, and command name, without the clutter.
The Solution: Use awk to filter and format the ps output for a cleaner, more focused view.
ps aux | awk '{printf "%-10s %-10s %-10s %-5s %-5s %-5s %s\n", $1, $2, $3, $4, $5, $6, $11}'
Why it works: awk is a powerful text-processing tool that can select specific fields (columns) from input. Here, we’re using printf within awk to align and display essential process information.
Pro-Tip: To see processes consuming the most CPU, pipe the output to sort -rnk 3 after using awk.
Linux Tips & Tricks | © ngelinux.com | 5/6/2026
