Site icon New Generation Enterprise Linux

Streamline `ps` Output: Focused Process Info with `awk`

Quick Tip

Streamline `ps` Output: Focused Process Info with `awk`

Challenge: The default output of the `ps` command can be overwhelming, displaying far more information than you might need when you’re trying to quickly identify specific processes based on their name or user.

The Solution: Combine `ps` with `awk` to filter and display only the essential columns you care about, making process monitoring significantly more efficient.

ps aux | awk '{print $1, $2, $11}' | grep 'my_process_name'

Why it works: `ps aux` provides a comprehensive snapshot of running processes. `awk ‘{print $1, $2, $11}’` then extracts specific fields (user, PID, and command name in this example), and `grep ‘my_process_name’` filters this reduced output to show only lines containing your target process.

Pro-Tip: Experiment with different field numbers in the `awk` command (e.g., `$3` for %CPU, `$4` for %MEM) to customize the output to your exact needs. You can also use `ps -eo pid,user,command` for a more structured input to awk.

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

0 0 votes
Article Rating
Exit mobile version