Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The output of the `ps` command can be overwhelming, often displaying more information than you need when you’re trying to quickly identify specific processes or their resource usage.

The Solution: Combine `ps` with `awk` to filter and display only the columns you’re interested in.

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

Why it works: This command pipes the full output of `ps aux` to `awk`. `awk` then processes each line and prints specific fields (columns). In this example, we’re printing the User, PID, %CPU, %MEM, and Command, which are common fields for quick process inspection.

Pro-Tip: To sort the output by CPU usage (descending), pipe the output to `sort -rnk3`.

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

0 0 votes
Article Rating
Exit mobile version