Site icon New Generation Enterprise Linux

Taming Process Output: Focused `ps` with `awk`

Quick Tip

Taming Process Output: Focused `ps` with `awk`

Challenge: The standard `ps` command can sometimes produce overwhelming amounts of information, making it difficult to pinpoint specific processes or their resource usage.

The Solution: Combine `ps` with `awk` to filter and format the output for a more readable and informative view.

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

Why it works: `ps aux` provides a comprehensive list of running processes, and `awk` then filters this output. The `/your_process_name/` part searches for lines containing your specified process name, and `{print $1, $2, $3, $4, $11}` extracts and displays only the User, PID, %CPU, %MEM, and Command columns for those matching lines.

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

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

0 0 votes
Article Rating
Exit mobile version