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

Quick Tip

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

Challenge: The standard `ps` command can produce a lot of information, making it difficult to quickly find specific processes or essential details like CPU and memory usage for a particular application.

The Solution: Combine `ps` with `awk` to filter and format the output for precisely what you need.

ps aux | awk '{if ($2 == "PID_OF_INTEREST") print $0}'

Why it works: `ps aux` provides a comprehensive list of running processes. `awk` then processes this output line by line, and we use a simple condition (`$2 == “PID_OF_INTEREST”`) to print only the line where the second column (the PID) matches our target.

Pro-Tip: To see the CPU and Memory usage for a specific process by name, use ps aux | grep "process_name" | awk '{print $3, $4}'. Replace "process_name" with the actual name of the process.

Linux Tips & Tricks | © ngelinux.com | 6/1/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments