Tame Your Processes: Focused `ps` Output with `awk`

Quick Tip

Tame Your Processes: Focused `ps` Output with `awk`

Challenge: The standard `ps` command can produce a lot of output, making it difficult to quickly find specific information about running processes, like just the process ID (PID) and command name for a particular service.

The Solution: Combine the `ps` command with `awk` to filter and format the output to show only the desired columns.

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

Why it works: `ps aux` lists all running processes with detailed information. `awk ‘/your_process_name/ {print $2, $11}’` then filters these lines to only include those containing “your_process_name” and prints the second column (PID) and the eleventh column (command name).

Pro-Tip: For a cleaner, more specific list, use `ps -eo pid,comm | grep your_process_name` for just the PID and command name.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted