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

Quick Tip

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

Challenge: The output of the `ps` command can be overwhelming when you need to quickly find specific process information, like the parent process ID (PPID) or command name for a particular user.

The Solution: Pipe the output of `ps aux` (or `ps -ef`) to `awk` to filter and format the data precisely.

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

Why it works: `awk` processes the output line by line. This command filters for lines where the first field (`$1`, the username) matches “your_username” and then prints the second field (`$2`, the PID) and the eleventh field (`$11`, the command). You can easily adjust the fields printed and the filtering criteria.

Pro-Tip: Use `ps aux | grep your_process_name | awk ‘{print $2}’` to quickly get the PID of a process by its name.

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