Site icon New Generation Enterprise Linux

Taming `ps` Output with `awk` for Focused Process Info

Quick Tip

Taming `ps` Output with `awk` for Focused Process Info

Challenge: The standard `ps` command can produce a lot of information, making it difficult to quickly find specific processes or essential details like CPU and memory usage.

The Solution: Leverage `awk` to filter and format `ps` output for better readability and targeted information retrieval.

ps aux | awk '{if ($3 > 5.0) print $0}' # Processes using more than 5% CPU ps aux | awk '{if ($4 > 100000) print $0}' # Processes using more than 100MB RAM ps aux | awk '{print $1, $2, $4, $11}' # User, PID, %MEM, COMMAND

Why it works: `awk` is a powerful text-processing tool that excels at parsing structured data. By piping `ps` output to `awk`, you can specify fields (columns) and apply conditions to display only the most relevant process information.

Pro-Tip: Combine this with `grep` to further narrow down your search based on process names or other keywords. For example: ps aux | grep 'nginx' | awk '{print $1, $2, $4, $11}'

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

0 0 votes
Article Rating
Exit mobile version