Site icon New Generation Enterprise Linux

Quick Process Info with `ps` and `awk`

Quick Tip

Quick Process Info with `ps` and `awk`

Challenge: When dealing with a large number of running processes, it’s often overwhelming to sift through the default `ps` output to find specific information or to create a concise summary.

The Solution: Combine `ps` with `awk` to filter and format the output, showing only the essential details you need.

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

Why it works: The `ps aux` command lists all running processes with detailed information. `awk` then processes this output line by line, printing only the specified columns (User, PID, %CPU, and Command in this example). This provides a clean, focused view of your processes.

Pro-Tip: To sort processes by CPU usage, pipe the output to `sort -rnk3` (for the 3rd column, %CPU): ps aux | awk '{print $1, $2, $4, $11}' | sort -rnk3

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

0 0 votes
Article Rating
Exit mobile version