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

Quick Tip

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

Challenge: The default `ps` command can be overwhelming, showing a lot of information about running processes that you might not need. This makes it difficult to quickly find specific details.

The Solution: Use `ps` in combination with `awk` to filter and format the output for exactly what you need.

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

Why it works: This command pipes the output of `ps aux` (which shows all processes for all users in a detailed format) to `awk`. `awk` then prints only the first ($1 – User), second ($2 – PID), and eleventh ($11 – Command) fields, giving you a clean, focused view of your running processes.

Pro-Tip: Replace `$1, $2, $11` with other field numbers or use conditional logic within `awk` for even more powerful filtering, e.g., `ps aux | awk ‘$1 == “root” {print $2, $11}’` to show only processes run by root and their commands.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments