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: You need to quickly find specific processes and extract only the essential information (like PID, command name, and CPU usage) from the often verbose output of the ps command.

The Solution: Combine ps aux with awk to filter and format the output.

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

Why it works: ps aux provides a comprehensive list of running processes. awk is then used to select specific columns (user, PID, command, CPU%), and grep filters this refined output for your desired process.

Pro-Tip: You can customize the columns printed by awk by changing the numbers (e.g., $1, $2, $11, $3). For instance, to see only PID and command, use awk '{print $2, $11}'.

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

0 0 votes
Article Rating
Exit mobile version