Taming Process Output: Focused `ps` with `awk`

Quick Tip

Taming Process Output: Focused `ps` with `awk`

Challenge: The output of the `ps` command can be overwhelmingly verbose when you’re trying to find specific information about running processes. You often need to sift through many columns to get to the CPU usage, memory footprint, or command path.

The Solution: Leverage the power of `awk` to filter and format the `ps` output for precisely what you need.

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

Why it works: This command pipes the output of `ps aux` (which shows all processes with user, CPU, memory, and command details) to `awk`. `awk` then processes each line, printing only the specified fields (User, PID, %CPU, and Command in this example). You can adjust the field numbers to extract any information you desire from the `ps` output.

Pro-Tip: To get a more readable header for your custom `ps` output, you can add an `echo` statement before the `ps` command, piping its output to `cat` along with the `awk` command: echo "USER PID %CPU COMMAND"; ps aux | awk '{print $1, $2, $4, $11}'

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments