Streamline Process Monitoring with `ps` and `awk`
Quick Tip
Streamline Process Monitoring with `ps` and `awk`
Challenge: Getting specific, formatted information from the `ps` command can be cumbersome, often requiring manual parsing or multiple commands.
The Solution: Leverage `awk` to precisely filter and format the output of `ps` for exactly the process information you need.
ps aux | awk '$1 == "your_user" && /your_process_name/ { print $2, $11, $12 }'
Why it works: `ps aux` provides detailed process information. `awk` then processes this output line by line, filtering for lines where the first field (‘$1’) matches ‘your_user’ AND the eleventh field (‘$11’) contains ‘your_process_name’. It then prints the process ID ($2), command name ($11), and its full command line ($12).
Pro-Tip: Use `ps -ef | grep ‘your_process_name’ | awk ‘{print $2, $8}’` for a quick PID and command name list.
Linux Tips & Tricks | © ngelinux.com | 5/11/2026
