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

Quick Tip

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

Challenge: The output of the `ps` command can be incredibly verbose, making it difficult to quickly find specific process information like CPU usage, memory consumption, or the full command line arguments.

The Solution: Combine `ps` with `awk` to filter and format the output, focusing only on the columns you need.

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

Why it works: This command pipes the output of `ps aux` (which shows all processes for all users with detailed information) to `awk`. `awk` then prints only the specified fields (User, PID, %CPU, %MEM, and Command) separated by spaces, giving you a cleaner, more targeted view of your processes.

Pro-Tip: You can customize the columns by changing the numbers in the `awk` ‘{print $1, $2, $3, $4, $11}’ part to match the headers you’re interested in. For instance, to see the full command line, you might use something like `ps aux | awk ‘{print $1, $2, $11}’` if you only need user, PID, and the command. For more structured output, you can use `awk ‘{printf “%-10s %-7s %-7s %-s\n”, $1, $2, $3, $11}’` for aligned columns.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments