Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The output of the `ps` command can be very verbose, making it difficult to quickly find specific process information like the user, PID, and command name.

The Solution: Use `awk` to filter and reformat the `ps` output to display only the essential columns.

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

Why it works: `ps aux` provides a comprehensive list of running processes. We then pipe this output to `awk`. `awk` processes the output line by line, and in this case, it prints the first column (USER), second column (PID), and eleventh column (COMMAND) for each process, effectively trimming the fat.

Pro-Tip: To sort this output by memory usage (descending), you can add `| sort -k2 -nr` after the `awk` command.

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

0 0 votes
Article Rating
Exit mobile version