Master `ps` Output: Focused Process Info with `awk`

Quick Tip

Master `ps` Output: Focused Process Info with `awk`

Challenge: The `ps` command provides a wealth of information about running processes, but it can be overwhelming. Often, you only need specific details like the process ID (PID), command name, and CPU/memory usage.

The Solution: Use `awk` to filter and format the output of `ps` for exactly the information you need.

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

Why it works: `ps aux` lists all processes with detailed information. `awk` then processes this output line by line, printing only the fields you specify (User, PID, %CPU, %MEM, Command). The field numbers ($1, $2, etc.) correspond to the columns in the `ps aux` output.

Pro-Tip: For even more targeted output, you can specify headers by adding a condition to `awk`, e.g., `ps aux | awk ‘NR==1 || $3 > 5.0 {print $1, $2, $3, $4, $11}’` to show the header and processes using more than 5% CPU.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted