Taming `ps` Output with Custom `awk` Formatting
Quick Tip
Taming `ps` Output with Custom `awk` Formatting
Challenge: The default output of the `ps` command can be overwhelming, especially when you need specific process information. Manually sifting through columns or using `grep` can be inefficient.
The Solution: Leverage the power of `awk` to selectively extract and format the process information you need from `ps` output.
ps aux | awk '{print $1, $2, $11}'
Why it works: This command pipes the full output of `ps aux` to `awk`. `awk` then processes each line, printing only the first (USER), second (PID), and eleventh (COMMAND) fields, providing a cleaner, more focused view of active processes.
Pro-Tip: You can easily customize the fields you display by changing the numbers within the curly braces. For example, `awk ‘{print $2, $4, $11}’` would show PID, %CPU, and COMMAND.
Linux Tips & Tricks | © ngelinux.com | 5/10/2026
