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: When troubleshooting or monitoring system performance, the output of the `ps` command can be overwhelming, often displaying more information than you need about running processes.

The Solution: Leverage the power of `awk` to filter and select specific columns from the `ps` command for a cleaner, more focused view of your processes.

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

Why it works: This command pipes the output of `ps aux` (which provides a comprehensive list of processes) to `awk`. `awk` then processes each line, printing only the specified fields: User (1), PID (2), %CPU (3), %MEM (4), and Command (11). This significantly simplifies the output, making it easier to identify key process details.

Pro-Tip: To filter processes by a specific user, add a condition like awk '$1 == "your_user" {print $1, $2, $3, $4, $11}' before the print statement.

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

0 0 votes
Article Rating
Exit mobile version