Quick Tip
Boost Your `ps` Output with Custom `awk` Formatting
Challenge: The default output of the ps command can be verbose and difficult to parse when you’re looking for specific process information, such as CPU or memory usage, associated with a particular user or command.
The Solution: Use awk to filter and format the output of ps for a cleaner, more relevant view.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: This command pipes the full output of ps aux to awk. awk then prints only the specified columns: user ($1), PID ($2), CPU percentage ($3), memory percentage ($4), and the command ($11), making it easier to scan for essential process details.
Pro-Tip: To sort by CPU usage in descending order, pipe the output to sort -rnk3 (after the awk command).
Linux Tips & Tricks | © ngelinux.com | 5/15/2026
