Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The output of the `ps` command can be overwhelming, especially when you need to quickly find specific information about processes.

The Solution: Use `awk` to filter and format the `ps` command’s output for targeted information.

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

Why it works: This command pipes the verbose output of `ps aux` to `awk`. `awk` then filters lines where the first field (`$1`, the username) matches “your_username” and prints the second field (`$2`, the PID) and the eleventh field (`$11`, the command name). This allows you to see only the processes owned by you and their associated PIDs and command names.

Pro-Tip: To find processes using a specific amount of CPU or memory, you can adjust the `awk` conditions. For example, to find processes using more than 10% CPU: `ps aux | awk ‘$3 > 10.0 { print $2, $11, $3 }’`

Linux Tips & Tricks | © ngelinux.com | 7/4/2026

0 0 votes
Article Rating
Exit mobile version