Tame Your `ps` Output: Focused Process Info with `awk`
Quick Tip
Tame Your `ps` Output: Focused Process Info with `awk`
Challenge: The output of the `ps` command can be overwhelming when you’re trying to find specific process information like the PID, user, and command name. You often end up scrolling through a lot of irrelevant data.
The Solution: Pipe the output of `ps` to `awk` to select and format only the columns you need.
ps aux | awk '{print $1, $2, $11}'
Why it works: `awk` is a powerful text-processing tool that can split lines into fields. In this case, `ps aux` provides detailed process information, and `awk ‘{print $1, $2, $11}’` selects the first field (USER), second field (PID), and eleventh field (COMMAND) from each line, giving you a clean, focused output.
Pro-Tip: Use `ps -ef | awk ‘{print $3, $2, $8}’` for a slightly different format that often includes the parent process ID (PPID) if needed, or `ps axjf | awk ‘{print $1, $2, $5}’` for a process tree view.`
Linux Tips & Tricks | © ngelinux.com | 6/25/2026
