Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The output of the `ps` command can be overwhelmingly verbose when you’re trying to find specific process information. Parsing through it manually can be time-consuming.

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

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

Why it works: This command pipes the output of `ps aux` (which shows all processes for all users) to `awk`. `awk` then filters lines where the first field (`$1`, the username) matches “your_user” and prints the second field (`$2`, the PID) and the eleventh field (`$11`, the command name).

Pro-Tip: To quickly see processes using a specific amount of CPU, you can modify the `awk` condition: ps aux | awk '$3 > 5.0 { print $2, $3, $11 }' (this shows processes using more than 5% CPU).

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

0 0 votes
Article Rating
Exit mobile version