Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The standard `ps` command often outputs a lot of information, making it difficult to quickly find specific details about running processes.

The Solution: Use `awk` to filter and format the `ps` output to display only the columns you need.

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

Why it works: This command pipes the output of `ps aux` to `awk`. `awk` then processes each line and prints only the first (USER), second (PID), and eleventh (COMMAND) fields, giving you a concise overview.

Pro-Tip: To see processes sorted by CPU usage, you can use `ps aux –sort=-%cpu | awk ‘{print $1, $2, $3, $11}’` to include the CPU percentage.

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

0 0 votes
Article Rating
Exit mobile version