Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The default output of the ps command can be overwhelmingly verbose, making it difficult to quickly find specific process information like the command name, PID, or CPU usage.

The Solution: Leverage awk to filter and format the output of ps for concise and targeted information.

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

Why it works: This command pipes the output of ps aux (which provides a detailed snapshot of running processes) to awk. awk then prints specific fields: $1 (USER), $2 (PID), $3 (%CPU), $4 (%MEM), and $11 (COMMAND), effectively filtering the output to show only the most crucial details.

Pro-Tip: For even more specific filtering, you can add conditions within awk. For example, to show only processes using more than 5% CPU: ps aux | awk '$3 > 5 {print $1, $2, $3, $4, $11}'

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

0 0 votes
Article Rating
Exit mobile version