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 verbose and sometimes difficult to parse for specific process information, especially when dealing with many running processes.
The Solution: Leverage `awk` to selectively display and format the output of `ps` for a cleaner, more targeted view.
ps aux | awk '{print $1, $2, $11}'
Why it works: This command pipes the output of `ps aux` (showing all processes for all users with detailed information) to `awk`. `awk` then processes each line and prints only the first ($1 – USER), second ($2 – PID), and eleventh ($11 – COMMAND) fields, effectively creating a customized, more readable output.
Pro-Tip: You can easily change the fields you want to see by modifying the numbers within the curly braces. For example, `ps aux | awk ‘{print $2, $4, $11}’` would show PID, %CPU, and COMMAND.
Linux Tips & Tricks | © ngelinux.com | 5/2/2026
