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

Quick Tip

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

Challenge: The default output of the `ps` command can be overwhelming when you’re trying to find specific process information, especially on busy systems. You might need to quickly identify processes by name, user, or CPU usage.

The Solution: Combine `ps` with `awk` to precisely filter and format the output to show only what you need.

ps aux | awk '/[p]rocess_name/ {print $1, $2, $3, $4, $11}'

Why it works: This command pipes the full output of `ps aux` to `awk`. `awk ‘/[p]rocess_name/’` filters lines that contain “process_name” (the `[p]` is a common trick to prevent `grep` from matching itself if you were using `grep`), and `{print $1, $2, $3, $4, $11}` then extracts and prints specific columns: USER, PID, %CPU, %MEM, and the COMMAND, respectively. Adjust the column numbers ($1, $2, etc.) and the process name to suit your needs.

Pro-Tip: Use `ps aux | awk ‘{print $1, $11}’` to quickly list all users and their running commands.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments