Taming `ps` Output: Focused Process Info with `awk`
Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The output of the `ps` command can be overwhelming, showing a lot of information you don’t need when you’re trying to find specific processes or their resource usage.
The Solution: Use `ps` in conjunction with `awk` to filter and display only the columns you’re interested in.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: `ps aux` provides a comprehensive snapshot of running processes. `awk` then acts as a powerful text processor, allowing us to select specific fields (columns) from each line of the output. In this example, we’re selecting the USER, PID, %CPU, %MEM, and COMMAND columns.
Pro-Tip: Combine this with `grep` to find specific processes. For example, ps aux | grep 'nginx' | awk '{print $1, $2, $3, $4, $11}' will show details for processes related to nginx.
Linux Tips & Tricks | © ngelinux.com | 6/21/2026
