Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The output of the `ps` command can be overwhelming, especially when you need to quickly find specific information about running processes. Filtering and selecting precise data can be tedious.

The Solution: Leverage `awk` to selectively display columns from the `ps` command for targeted process information.

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

Why it works: This command pipes the output of `ps aux` (showing all processes for all users in BSD format) to `awk`. `awk` then processes each line and prints only the specified fields: user, PID, %CPU, and command name.

Pro-Tip: To filter for a specific process, like `nginx`, you can add a condition to `awk`: ps aux | awk '/nginx/ {print $1, $2, $4, $11}'

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

0 0 votes
Article Rating
Exit mobile version