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: When dealing with a large number of processes, the output of the `ps aux` command can be overwhelming, making it difficult to quickly find specific information like the command name or parent process ID (PPID).

The Solution: Pipe the output of `ps aux` to `awk` to select and format only the columns you need.

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

Why it works: `awk` allows you to specify which fields (columns) to print from the input. In this case, we’re selecting the USER (column 1), PID (column 2), %CPU (column 3), and the COMMAND (column 11) for a more focused view.

Pro-Tip: To also include the PPID (column 3 in the original output), adjust the `awk` command to: ps aux | awk '{print $1, $2, $3, $4, $11}'

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

0 0 votes
Article Rating
Exit mobile version