Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The `ps` command can be overwhelming with its extensive output, 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 clarity and targeted information retrieval.

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

Why it works: This command uses `ps aux` to list all processes with detailed information and then pipes it to `awk`. `awk` then prints only the specified columns (user, PID, CPU%, MEM%, and command name) from each line, significantly simplifying the output.

Pro-Tip: You can easily customize the columns printed by `awk` by changing the numbers within the curly braces. For example, `awk ‘{print $1, $2, $11}’` would only show the user, PID, and command name.

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

0 0 votes
Article Rating
Exit mobile version