Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The default `ps` command often outputs a lot of information, making it difficult to quickly find specific details about running processes. You might want to see just the PID and command name, or filter by user, without wading through columns of irrelevant data.

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

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

Why it works: This command uses `ps aux` to get a comprehensive list of running processes and then pipes it to `awk`. `awk ‘{print $1, $11}’` tells `awk` to print only the first column (the user) and the eleventh column (the command name) for each line of output, giving you a cleaner, more focused view.

Pro-Tip: To see only the PID and Command Name, use `ps ax | awk ‘{print $1, $4}’`. Remember that column numbers can vary slightly based on your `ps` configuration; `ps aux` is generally a safe bet for consistency.

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

0 0 votes
Article Rating
Exit mobile version