Site icon New Generation Enterprise Linux

Tame Your `ps` Output with Custom `awk` Formatting

Quick Tip

Tame Your `ps` Output with Custom `awk` Formatting

Challenge: The output of the `ps` command can be overwhelmingly verbose, making it difficult to quickly find the specific process information you need.

The Solution: Use `awk` to filter and format `ps` output for a cleaner, more focused view.

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

Why it works: `awk` allows you to select and display only the columns you’re interested in from the `ps` output. In this example, we’re showing the User (column 1), PID (column 2), and the Command (column 11).

Pro-Tip: To sort by memory usage (column 4), you can pipe the output to `sort -nrk4` before `awk`: `ps aux | sort -nrk4 | awk ‘{print $1, $2, $11}’`

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

0 0 votes
Article Rating
Exit mobile version