Site icon New Generation Enterprise Linux

Tame Your Processes: Focused `ps` Output with `awk`

Quick Tip

Tame Your Processes: Focused `ps` Output with `awk`

Challenge: The output of the `ps` command can be overwhelming, especially when trying to find specific process information like CPU usage, memory consumption, or command names.

The Solution: Combine `ps` with `awk` to selectively display only the columns you need.

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

Why it works: `awk` allows you to process text line by line and field by field. By specifying the desired column numbers (e.g., $1 for USER, $3 for %CPU, $4 for %MEM, and $11 for COMMAND), you can filter and format the `ps` output to show exactly what you’re looking for.

Pro-Tip: Use `ps aux | awk ‘NR > 1 {print $1, $3, $4, $11}’` to skip the header line from the `ps aux` output.

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

0 0 votes
Article Rating
Exit mobile version