Site icon New Generation Enterprise Linux

Tame Your `ps` Output with `awk`

Quick Tip

Tame Your `ps` Output with `awk`

Challenge: The default output of the `ps` command can be verbose and difficult to parse when you need specific process information quickly. You often have to sift through columns you don’t care about.

The Solution: Use `awk` to filter and format the `ps` output to display only the essential process details.

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

Why it works: This command pipes the output of `ps aux` to `awk`. `awk` then processes each line, printing only the fields for USER ($1), PID ($2), %CPU ($4), and COMMAND ($11), effectively creating a cleaner, more targeted view of your running processes.

Pro-Tip: To see only processes owned by the current user, add a condition like 'NR > 1 && $1 == ENVIRON["USER"] {print $2, $11}'.

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

0 0 votes
Article Rating
Exit mobile version