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

Quick Tip

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

Challenge: The default `ps` command can be overwhelming with a lot of process information. Often, you only need to see specific details like the PID, user, and command name for a particular process.

The Solution: Use `ps` in conjunction with `awk` to filter and display only the columns you need.

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

Why it works: `ps aux` lists all running processes with detailed information. `awk` then filters these lines, searching for ‘your_process_name’, and prints only the first, second, and eleventh fields (typically USER, PID, and COMMAND respectively). Adjust the field numbers if your `ps` output differs.

Pro-Tip: For even finer control, you can use `ps -eo user,pid,command` to specify the exact columns `ps` should output before piping to `awk`.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted