Site icon New Generation Enterprise Linux

Master `ps` Output with `awk` for Focused Process Information

Quick Tip

Master `ps` Output with `awk` for Focused Process Information

Challenge: The default `ps aux` output can be overwhelming, making it difficult to quickly find specific process information like CPU or memory usage for a particular user or service.

The Solution: Combine `ps` with `awk` to elegantly filter and reformat process information to show only what you need.

ps aux | awk '$1 == "your_user" {print $1, $2, $3, $4, $11}'

Why it works: `ps aux` lists all running processes. `awk` then filters these lines, printing only those where the first field (`$1`, representing the user) matches “your_user”. It then prints specific columns (user, PID, %CPU, %MEM, and command) for that process.

Pro-Tip: You can easily adapt this to filter by process name by changing the `awk` condition, e.g., ps aux | awk '/nginx/ {print $1, $2, $11}'.

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

0 0 votes
Article Rating
Exit mobile version