Taming `ps` Output with Custom `awk` Formatting
Quick Tip
Taming `ps` Output with Custom `awk` Formatting
Challenge: The standard output of the ps command can be overwhelming, showing a lot of information you might not need. It’s often difficult to quickly find specific process details like CPU usage, memory, or command name in a human-readable format.
The Solution: Leverage awk to filter and format the output of ps to display only the essential information you need.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: This command pipes the output of ps aux (which shows all processes for all users in a detailed format) to awk. awk then prints specific fields (user, PID, %CPU, %MEM, and command name) for each process, creating a cleaner and more focused view.
Pro-Tip: You can customize the field numbers in the awk command to display different columns from the ps output. For instance, ps aux | awk '{print $11}' will only show the command names.
Linux Tips & Tricks | © ngelinux.com | 5/8/2026
