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 verbose and difficult to parse when you’re looking for specific process information like CPU usage, memory, or command name.

The Solution: Combine `ps` with `awk` to extract and display only the columns you need, making process monitoring much more efficient.

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

Why it works: `ps aux` provides a comprehensive list of running processes, and `awk` processes this output line by line, printing only the specified fields (in this case: USER, PID, %CPU, %MEM, COMMAND). Adjust the numbers to select different columns.

Pro-Tip: Use `ps -eo pid,ppid,cmd,%cpu,%mem –sort=-%cpu | head` to see the top 10 CPU-consuming processes in a more readable format.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted