Site icon New Generation Enterprise Linux

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

Quick Tip

Master `ps` Output 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 the full command line or parent process ID (PPID).

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

ps aux | awk 'NR==1 || $1 == "YOUR_USERNAME" { print $0 }'

Why it works: `ps aux` provides a comprehensive snapshot of processes. `awk` is then used to filter this output: `NR==1` ensures the header row is always included, and `$1 == “YOUR_USERNAME”` filters for processes owned by a specific user (replace “YOUR_USERNAME” with the actual username). You can further refine the output by specifying which columns `awk` should print.

Pro-Tip: To see processes and their parent process IDs (PPIDs), use ps -eo pid,ppid,cmd.

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

0 0 votes
Article Rating
Exit mobile version