Site icon New Generation Enterprise Linux

Taming `ps` Output with `awk` for Focused Process Info

Quick Tip

Taming `ps` Output with `awk` for Focused Process Info

Challenge: When running `ps aux`, you often get a lot of columns you don’t need, making it hard to find specific information like the process ID (PID) or the command name quickly.

The Solution: Use `awk` to select and reorder specific columns from the `ps` output.

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

Why it works: `awk` processes the output line by line, and `$1`, `$2`, and `$11` represent the User, PID, and Command columns respectively. This allows you to tailor the output to exactly what you need.

Pro-Tip: For a more readable output, you can add column headers using `echo “USER PID COMMAND” && ps aux | awk …`

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

0 0 votes
Article Rating
Exit mobile version