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 CPU or memory usage for a particular application.

The Solution: Combine `ps` with `awk` to filter and format the output for targeted process monitoring.

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

Why it works: `awk` allows you to select and rearrange specific columns from the `ps` output. In this example, we’re printing the USER, PID, %CPU, %MEM, and COMMAND, making it easy to spot the relevant details for your process.

Pro-Tip: You can further refine this by using `grep` before `awk` to isolate processes if `awk`’s pattern matching isn’t precise enough, e.g., ps aux | grep 'your_process_name' | awk '{print $1, $2, $3, $4, $11}'.

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

0 0 votes
Article Rating
Exit mobile version