Site icon New Generation Enterprise Linux

Supercharge `ps` Output with Custom `awk` Formatting

Quick Tip

Supercharge `ps` Output with Custom `awk` Formatting

Challenge: The default output of the `ps` command can be verbose and not always display the exact process information you need in a clean, organized way.

The Solution: Leverage `awk` to filter and format the `ps` command’s output, displaying only the desired columns.

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

Why it works: This command pipes the output of `ps aux` (which shows all processes for all users) to `awk`. `awk` then processes each line and prints only the fields corresponding to the User (column 1), PID (column 2), %CPU (column 3), and Command (column 11), creating a concise, custom view.

Pro-Tip: You can easily customize the columns by changing the numbers within the curly braces. For example, to also include %MEM (column 4), use awk '{print $1, $2, $3, $4, $11}'.

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

0 0 votes
Article Rating
Exit mobile version