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 output of the ps command can be overwhelming, especially when you’re trying to find specific process details like CPU or memory usage for a particular application.

The Solution: Pipe the output of ps aux (or ps -ef) to awk to filter and format the information you need.

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

Why it works: awk allows you to specify which fields (columns) from the ps output you want to display. By printing specific fields and then using grep, you can isolate the exact process information you’re looking for.

Pro-Tip: Use ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head to quickly see the top CPU-consuming processes.

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

0 0 votes
Article Rating
Exit mobile version