Site icon New Generation Enterprise Linux

Streamline Process Monitoring with `ps` and `awk`

Quick Tip

Streamline Process Monitoring with `ps` and `awk`

Challenge: The default output of the `ps` command can be overly verbose, making it difficult to quickly extract specific process information like the process ID (PID), user, and command. You need a way to filter and format this output efficiently.

The Solution: Combine `ps` with `awk` to create a custom, concise process listing.

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

Why it works: `ps aux` provides a comprehensive list of running processes. `awk` is a powerful text-processing utility that can parse this output. By specifying `$2`, `$1`, and `$11`, we instruct `awk` to print only the PID (second column), the user (first column), and the command (eleventh column) for each process, effectively filtering out unnecessary information.

Pro-Tip: To also include the CPU usage (column 3) and memory usage (column 4), simply add them to the `print` statement: ps aux | awk '{print $2, $1, $3, $4, $11}'.

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

0 0 votes
Article Rating
Exit mobile version