Tame Your Processes: Focused `ps` Output with `awk`

Quick Tip

Tame Your Processes: Focused `ps` Output with `awk`

Challenge: The output of the `ps` command can be overwhelming, showing a lot of process information that you might not need. You want to quickly find specific details about processes, like their parent process ID (PPID) or the command they are running.

The Solution: Combine `ps` with `awk` for targeted output. For example, to see just the PID, PPID, and command for all processes, use:

ps aux | awk 'NR==1 {print $0} NR>1 {print $1, $2, $11}'

Why it works: `ps aux` provides a comprehensive list of processes. `awk` then processes this output line by line. `NR==1` prints the header row as is, and `NR>1` prints specific fields (user, PID, and command) from subsequent lines, effectively filtering the output.

Pro-Tip: You can easily modify the `print` statement within `awk` to display any columns you need. For example, `print $1, $4, $11` would show User, %CPU, and Command.

Linux Tips & Tricks | © ngelinux.com | 5/20/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments