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, containing a lot of information about running processes. Often, you only need to see specific details like the PID, command name, and CPU/memory usage.

The Solution: Leverage the power of `awk` to filter and format the output of `ps` to display only the columns you need.

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

Why it works: This command pipes the output of `ps aux` (which provides a detailed, user-oriented listing of processes) to `awk`. `awk` then processes each line, printing only the first ($1 – USER), second ($2 – PID), and eleventh ($11 – COMMAND) fields. You can adjust the field numbers to display different information.

Pro-Tip: To get a more human-readable output with headers, you can add a header line using `awk ‘NR==1{print “USER PID COMMAND”} NR>1{print $1, $2, $11}’` or by using `ps aux | awk ‘BEGIN {print “USER PID COMMAND”} {print $1, $2, $11}’`.

Linux Tips & Tricks | © ngelinux.com | 6/3/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments