Master Your `ps` Output: Focused Process Info with `awk`

Quick Tip

Master Your `ps` Output: Focused Process Info with `awk`

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

The Solution: Combine `ps` with `awk` to precisely select and display the columns you need.

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

Why it works: This command pipes the output of `ps aux` (which shows all processes with user, CPU, and memory details) to `awk`. `awk ‘{print $1, $2, $4, $11}’` then processes each line, printing only the first (user), second (PID), fourth (CPU usage), and eleventh (command name) fields.

Pro-Tip: To sort processes by CPU usage, use ps aux --sort=-%cpu | awk '{print $1, $2, $4, $11}'.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted