Master `ps` Output with Custom `awk` Formatting

Quick Tip

Master `ps` Output with Custom `awk` Formatting

Challenge: The standard `ps` command provides a lot of process information, but it can be overwhelming and difficult to extract specific details quickly. You often find yourself sifting through columns that you don’t need.

The Solution: Combine `ps` with `awk` to select and format only the columns you care about. For example, to see just the PID, TTY, and the command for all running processes, use:

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

Why it works: `ps aux` lists all processes with detailed information. `awk` then processes this output line by line, and we instruct it to print only the second field (PID), first field (User), and eleventh field (Command). You can adjust the numbers to display any columns you wish.

Pro-Tip: To make this more readable, you can add column headers within your `awk` script: ps aux | awk 'NR==1 {print "PID USER COMMAND"} NR>1 {print $2, $1, $11}'

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments