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 overwhelming, especially on busy systems. It often includes a lot of columns that you might not need for quick analysis.

The Solution: You can leverage the power of `awk` to filter and display only the specific columns from `ps` that you’re interested in, making it much easier to find the information you need quickly.

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

Why it works: This command pipes the full output of `ps aux` to `awk`. `awk` then processes each line, and the `{print $1, $2, $11}` part tells it to print only the first, second, and eleventh fields (columns) of each line. By default, `awk` uses whitespace as a delimiter, which works perfectly with `ps` output.

Pro-Tip: To see custom headers for your selected columns, you can use `awk ‘BEGIN {print “USER\tPID\tCOMMAND”} {print $1, $2, $11}’`.

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

0 0 votes
Article Rating
Exit mobile version