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 `ps aux` output can be overwhelming with too much information. Often, you need to quickly filter and view specific details about running processes.

The Solution: Combine `ps` with `awk` to selectively display process information.

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

Why it works: `awk` processes the output of `ps aux` line by line, and by specifying column numbers (e.g., `$1` for user, `$2` for PID, `$3` for %CPU, `$4` for %MEM, and `$11` for the command name), we can create a concise and targeted view of the process information you need.

Pro-Tip: To sort processes by CPU usage, pipe the output to `sort -k 3 -nr` (sort numerically, reverse order, by the 3rd column).

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

0 0 votes
Article Rating
Exit mobile version