Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The default output of the `ps` command can be overwhelming, especially on busy systems. You often need to filter it to find specific processes or relevant information quickly.

The Solution: Combine `ps` with `awk` for precise filtering and formatting of process information.

ps aux | awk '/my_process_name/ {print $1, $2, $11}'

Why it works: `ps aux` provides a comprehensive list of running processes. The `awk` command then filters these lines based on the pattern ‘my_process_name’ and extracts specific fields (user, PID, and command name in this case) for a cleaner, more targeted output.

Pro-Tip: Use `ps -ef | grep my_process_name` as a more direct, though sometimes less flexible, alternative for simple name-based filtering.

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

0 0 votes
Article Rating
Exit mobile version