Master `ps` with `awk` for Focused Process Information

Quick Tip

Master `ps` with `awk` for Focused Process Information

Challenge: The output of the `ps` command can be overwhelmingly verbose, making it difficult to quickly find specific process information like parent process ID (PPID) or command line arguments.

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

ps aux | awk '{ print "PID:", $2, "PPID:", $3, "CMD:", $11 }'

Why it works: `ps aux` provides a comprehensive snapshot of running processes. `awk` then processes this output line by line, allowing you to specify which fields (columns) to print and in what order. In this example, we’re printing the Process ID ($2), Parent Process ID ($3), and the command itself ($11).

Pro-Tip: Use `ps -eo pid,ppid,cmd` for a more direct way to select columns without relying on `awk`’s field numbers, which can sometimes vary.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments