Tame `ps` Output with Custom `awk` Formatting
Quick Tip
Tame `ps` Output with Custom `awk` Formatting
Challenge: The default output of the `ps` command can be noisy and difficult to parse for specific process information. Extracting just the process ID (PID) and the command name can be tedious.
The Solution: Use `awk` to filter and format the output of `ps` for a cleaner, more focused view.
ps aux | awk '{print $2, $11}'
Why it works: The `ps aux` command lists all running processes with user, CPU, and memory information. `awk ‘{print $2, $11}’` then selects and prints the second field (PID) and the eleventh field (command name) from each line of the output.
Pro-Tip: To also see the full command line, including arguments, you can use `ps -ef | awk ‘{print $2, $8}’`.
Linux Tips & Tricks | © ngelinux.com | 5/2/2026
