Site icon New Generation Enterprise Linux

Taming Process Sprawl: Focused `ps` Output with `awk`

Quick Tip

Taming Process Sprawl: Focused `ps` Output with `awk`

Challenge: The standard `ps aux` output can be overwhelming, especially when you’re looking for specific process details like CPU usage or parent process ID (PPID).

The Solution: Use `ps` in conjunction with `awk` to filter and format the process list for crucial information.

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

Why it works: This command pipes the output of `ps aux` (which lists all running processes with user, CPU, memory, and command) to `awk`. `awk` then prints specific columns: user ($1), PID ($2), CPU usage ($4), and the command itself ($11), providing a more focused view.

Pro-Tip: To see processes sorted by CPU usage, pipe the output to `sort -k4nr` (for numeric, reverse sort on the 4th column, which is CPU usage).

Linux Tips & Tricks | © ngelinux.com | 7/1/2026

0 0 votes
Article Rating
Exit mobile version