Master `ps` Output: Focused Process Info with `awk`

Quick Tip

Master `ps` Output: Focused Process Info with `awk`

Challenge: The `ps` command provides a wealth of information about running processes, but it can often be overwhelming. You need a quick way to filter and extract specific details like PID, CPU usage, and command name.

The Solution: Combine `ps` with `awk` to precisely extract the information you need.

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

Why it works: `ps aux` lists all running processes with user information. `awk` then processes this output line by line, and we specify the fields (columns) to print: $2 for PID, $3 for CPU percentage, and $11 for the command name (adjust column number if necessary based on your `ps` output format).

Pro-Tip: Use `ps -eo pid,pcpu,comm` for a more direct, column-specified output without needing to parse with `awk` if your `ps` version supports it.

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