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, often displaying far more information than you need when trying to quickly identify specific processes.

The Solution: Combine `ps` with `awk` to precisely filter and display only the columns you care about.

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

Why it works: `ps aux` provides a detailed snapshot of all running processes. `awk` then processes this output line by line, printing only the specified fields: user ($1), PID ($2), and command ($11). You can customize the printed fields based on your needs.

Pro-Tip: To sort processes by CPU usage, pipe the output through `sort -rnk3` before `awk`.

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

0 0 votes
Article Rating
Exit mobile version