Site icon New Generation Enterprise Linux

Tame Your Processes: Focused `ps` Output with `awk`

Quick Tip

Tame Your Processes: Focused `ps` Output with `awk`

Challenge: The standard `ps` command can overwhelm you with a massive amount of information about running processes. It’s often difficult to quickly find specific details like a process’s CPU usage or memory consumption, especially when dealing with many processes.

The Solution: Combine the power of `ps` with `awk` to filter and format process information, providing a clean and focused output.

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

Why it works: `ps aux` lists all running processes with user, CPU, and memory information. `awk` then processes this output line by line, printing only the specified fields: user (column 1), %CPU (column 3), %MEM (column 4), and the command name (column 11), making it much easier to scan for relevant details.

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

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

0 0 votes
Article Rating
Exit mobile version