Taming `ps` Output: Focused Process Info with `awk`
Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The standard `ps` command often outputs a lot of information, making it difficult to quickly find specific details about processes, such as their PIDs and associated users.
The Solution: You can 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, `awk` prints the first ($1 – USER), second ($2 – PID), and eleventh ($11 – COMMAND) fields of the `ps aux` output, giving you a concise view of processes.
Pro-Tip: To filter for a specific process, you can add a condition within `awk`, like `awk ‘/nginx/{print $1, $2, $11}’` to only show lines containing “nginx”.
Linux Tips & Tricks | © ngelinux.com | 5/13/2026
