Site icon New Generation Enterprise Linux

Master `ps` with `awk`: Focused Process Information

Quick Tip

Master `ps` with `awk`: Focused Process Information

Challenge: The standard `ps` command often outputs a wealth of information, making it difficult to quickly find specific details about running processes. We need a way to filter and display only the most relevant columns.

The Solution: Combine `ps` with `awk` to extract and display only the columns you need, such as PID, User, CPU usage, and Command.

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

Why it works: `ps aux` provides a comprehensive list of processes. `awk` then processes this output line by line, and the `{print $1, $2, $3, $4, $11}` part tells it to print the 1st, 2nd, 3rd, 4th, and 11th fields (columns) of each line, effectively giving you a customized view.

Pro-Tip: You can customize the column numbers to display any information available in the `ps aux` output. For example, to see memory usage as well, you could use `ps aux | awk ‘{print $1, $2, $3, $4, $5, $11}’` (adding $5 for RSS memory).

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

0 0 votes
Article Rating
Exit mobile version