Site icon New Generation Enterprise Linux

Tame Your Processes: Focused `ps` Output with `awk`

Quick Tip

Tame Your Processes: Focused `ps` Output with `awk`

Challenge: The `ps` command can be incredibly verbose, making it difficult to quickly find specific information about running processes. Often, you only need to see a few key details.

The Solution: Combine `ps` with `awk` for highly targeted process information.

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

Why it works: `ps aux` lists all processes with detailed information. `awk` then filters this output. The pattern `/[p]rocess_name/` is a common `awk` trick to match the process name while preventing `awk` itself from appearing in the results. We then specify which columns to print (user, PID, CPU%, MEM%, and command).

Pro-Tip: For a more dynamic `ps` view, you can use `watch -n 1 ‘ps aux | awk …’` to update the output every second.

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

0 0 votes
Article Rating
Exit mobile version