Site icon New Generation Enterprise Linux

Master Process Monitoring with `ps` and `awk`

Quick Tip

Master Process Monitoring with `ps` and `awk`

Challenge: The default output of the `ps` command can be overwhelming when you need to quickly find specific information about running processes, such as their CPU or memory usage, and you want to format it for easier readability.

The Solution: Combine `ps` with `awk` to selectively display and format process information.

ps aux | awk '{printf "%-10s %-30s %-5s %-5s %-10s %s\n", $1, $11, $3, $4, $6, $10}'

Why it works: `ps aux` lists all running processes with detailed information. `awk` then takes this output and, using `printf`, formats specific columns (user, command, %CPU, %MEM, RSS, command) into a more organized, fixed-width layout.

Pro-Tip: Use `ps auxf` to get a tree-like view of processes, which can be incredibly useful for understanding process hierarchies.

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

0 0 votes
Article Rating
Exit mobile version