Tame Your `ps` Output: Focused Process Info with `awk`

Quick Tip

Tame Your `ps` Output: Focused Process Info with `awk`

Challenge: The output of the `ps` command can be overwhelming, filled with columns you might not always need. Extracting specific information, like just the process ID (PID) and command name, can be tedious.

The Solution: Leverage the power of `awk` to filter and format the `ps` output, giving you precisely the information you need.

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

Why it works: This command pipes the output of `ps aux` (which shows all processes with user, CPU, memory, etc.) to `awk`. `awk` then processes each line, printing only the second column (PID) and the eleventh column (COMMAND) by default.

Pro-Tip: To select different columns, simply change the numbers within the curly braces. For example, `ps aux | awk ‘{print $1, $2, $11}’` would show the user, PID, and command.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments