Taming `ps`: Focused Process Info with `awk`

Quick Tip

Taming `ps`: Focused Process Info with `awk`

Challenge: The output of the `ps` command can be overwhelming, filled with columns of information that you may not need when troubleshooting or monitoring specific processes. Extracting just the essential details can be a tedious manual task.

The Solution: Use `awk` to filter and format the output of `ps` to display only the columns you care about.

ps aux | awk '{print $1, $2, $3, $11}'

Why it works: `awk` is a powerful text-processing utility. By piping the output of `ps aux` to `awk`, we can instruct `awk` to print specific fields (columns) from each line of the `ps` output. In this example, we’re printing the User, PID, %CPU, and Command.

Pro-Tip: To create a more readable output with headers, you can add a header row like this: ps aux | awk 'NR==1 {print "USER\tPID\t%CPU\tCOMMAND"} NR!=1 {print $1"\t"$2"\t"$3"\t"$11}'

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments