Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The output of the `ps` command can be overwhelming, showing far more information than you need when trying to find specific processes or their resource usage.

The Solution: Leverage `awk` to filter and format the output of `ps` to display only the columns you care about.

ps aux | awk '$1 == "your_user" { print $2, $11, $4, $6 }'

Why it works: The `ps aux` command provides a comprehensive list of running processes. `awk` then processes this output line by line, filtering for lines where the first column (`$1`) matches your username and printing only the process ID (`$2`), command name (`$11`), CPU usage (`$4`), and memory usage (`$6`).

Pro-Tip: To see processes owned by a specific user, replace $1 == "your_user" with $1 == "other_user". For a concise overview of processes, consider ps -ef | awk '/your_process_name/ {print $2, $8}'.

Linux Tips & Tricks | © ngelinux.com | 5/18/2026

0 0 votes
Article Rating
Exit mobile version