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 CPU usage, memory consumption, or command-line arguments for a particular process.

The Solution: Leverage `awk` to filter and format the output of `ps` for targeted process inspection.

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

Why it works: This command pipes the full output of `ps aux` to `awk`. `awk` then searches for lines containing “your_process_name” and prints specific fields: User (1), PID (2), %CPU (3), %MEM (4), and the Command (11). You can adjust the field numbers to extract precisely what you need.

Pro-Tip: Use `ps -ef | grep your_process_name` as a quicker, albeit less customizable, alternative for basic searching.

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

0 0 votes
Article Rating
Exit mobile version