Site icon New Generation Enterprise Linux

Master `ps` Output with Custom `awk` Formatting

Quick Tip

Master `ps` Output with Custom `awk` Formatting

Challenge: The default output of the `ps` command can be verbose and difficult to parse for specific process information. You often need to sift through a lot of columns to find what you’re looking for.

The Solution: Use `awk` to select and format the specific columns you need from the `ps` command’s output.

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

Why it works: The `ps aux` command provides a detailed snapshot of running processes. `awk` then processes this output line by line, and the `{print $1, $2, $11}` part instructs `awk` to print only the first, second, and eleventh fields (representing USER, PID, and COMMAND respectively) for each process, giving you a cleaner, more focused view.

Pro-Tip: To see only processes owned by a specific user, you can add a condition like: ps aux | awk '$1 == "yourusername" {print $1, $2, $11}'

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

0 0 votes
Article Rating
Exit mobile version