Taming `ps` Output: Focused Process Info with `awk`
Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The standard `ps aux` command outputs a lot of information, making it difficult to quickly find specific details about processes, such as their CPU or memory usage.
The Solution: Combine `ps` with `awk` to filter and display only the columns you need. For instance, to see process ID, %CPU, and %MEM, you can use:
ps aux | awk '{print $1, $3, $4}'
Why it works: `awk` processes the output of `ps` line by line and allows you to select specific fields (columns) based on their position. In this case, $1 is the USER, $3 is %CPU, and $4 is %MEM.
Pro-Tip: You can customize the output even further by adding headers with `awk ‘NR==1 {print $1, $3, $4} NR>1 {print $1, $3, $4}’`.
Linux Tips & Tricks | © ngelinux.com | 5/31/2026
