Master `ps` Output: Focused Process Info with `awk`
Quick Tip
Master `ps` Output: Focused Process Info with `awk`
Challenge: The default output of the `ps` command can be overwhelming, showing a lot of information about running processes that you might not need. It’s often difficult to quickly pinpoint specific processes or identify key details like CPU and memory usage.
The Solution: Combine `ps` with `awk` to filter and format the output for a clear, concise view of what you need.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: `ps aux` lists all processes for all users. `awk` then processes this output line by line, printing only specific fields (user, PID, %CPU, %MEM, and command name) based on their column position. This provides a highly readable summary of your system’s active processes.
Pro-Tip: To sort processes by CPU usage, pipe the output to `sort -nrk3`. For memory usage, use `sort -nrk4`.
Linux Tips & Tricks | © ngelinux.com | 6/14/2026
