Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The `ps` command can be overwhelming, displaying a vast amount of process information that often isn’t relevant to your immediate needs. Filtering and extracting specific details can be tedious.

The Solution: Use `ps` in conjunction with `awk` to precisely select and display the process information you want.

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

Why it works: This command pipes the output of `ps aux` (which shows all processes with user, CPU/memory usage, and command) to `awk`. `awk` then processes each line, printing only the first, second, and eleventh fields, which typically correspond to the user, PID, and command name, respectively.

Pro-Tip: To see only processes owned by the current user, use ps -u $(whoami) -o pid,comm.

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

0 0 votes
Article Rating
Exit mobile version