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

Quick Tip

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

Challenge: The default output of the `ps` command can be overwhelming, showing far more information than you might need when trying to find specific processes or monitor system resources.

The Solution: Leverage `awk` to filter and format `ps` output for targeted information.

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

Why it works: This command pipes the output of `ps aux` (which shows all processes for all users in detailed format) to `awk`. `awk` then filters for lines containing “process_name” (the `[p]` prevents `awk` itself from matching) and prints specific columns: the User ID (column 1), the PID (column 2), and the Command Name (column 11).

Pro-Tip: You can easily modify the `awk` pattern and column numbers to extract precisely the process information you need. For example, to see all processes for a specific user: ps aux | awk -v user="username" '$1 == user {print $2, $11}'

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted