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

Quick Tip

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

Challenge: The `ps` command provides a wealth of information about running processes, but often you need to filter it down to specific fields or identify processes based on complex criteria. Manually sifting through the output can be tedious and error-prone.

The Solution: Combine `ps` with `awk` to precisely select and format the process information you need.

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

Why it works: `awk` is a powerful text-processing tool that can split lines into fields and perform actions based on those fields. In this case, we’re telling `awk` to print only the username (field 1), the PID (field 2), and the command name (field 11) from the output of `ps aux`.

Pro-Tip: Use `ps aux | awk ‘/nginx/ {print $1, $2, $11}’` to filter for lines containing “nginx” before printing specific fields.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments