Site icon New Generation Enterprise Linux

Tame Your Processes: Focused `ps` Output with `awk`

Quick Tip

Tame Your Processes: Focused `ps` Output with `awk`

Challenge: The output of the `ps` command can be overwhelming, displaying a lot of process information you might not need when you’re trying to quickly find specific details like the process ID (PID) or command name.

The Solution: Combine `ps` with `awk` to filter and display only the columns you’re interested in.

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

Why it works: `ps aux` provides a comprehensive snapshot of all running processes. `awk` then processes this output line by line, and `'{print $1, $2, $11}’` instructs it to print the first (username), second (PID), and eleventh (command name) fields of each line, effectively cleaning up the output.

Pro-Tip: To filter `ps` output for a specific process, you can pipe it to `grep` *before* `awk`, like `ps aux | grep “my_process” | awk ‘{print $1, $2, $11}’`.

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

0 0 votes
Article Rating
Exit mobile version