Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The output of the `ps` command can be verbose, making it difficult to quickly find specific process information like PID, CPU usage, or command name.

The Solution: Combine `ps` with `awk` to filter and format the output for precisely the information you need.

ps aux | awk '{print $2, $3, $11}'

Why it works: `ps aux` provides a comprehensive snapshot of running processes. `awk` then processes this output line by line, printing only the second column (PID), third column (CPU%), and eleventh column (command name), effectively filtering out extraneous data.

Pro-Tip: To see only processes owned by a specific user, like ‘nginx’, you can add a condition to awk: ps aux | awk -v user='nginx' '$1 == user {print $2, $3, $11}'

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

0 0 votes
Article Rating
Exit mobile version