Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The standard `ps aux` or `ps -ef` commands can produce verbose output, making it difficult to quickly find specific process information like command name, CPU usage, or memory consumption.
The Solution: Combine `ps` with `awk` to precisely select and format the columns you need.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: `awk` allows you to specify which fields (columns) you want to display from the output of `ps`. In this example, we’re selecting the USER, PID, %CPU, %MEM, and COMMAND columns. You can easily adjust the column numbers ($1, $2, etc.) to tailor the output further.
Pro-Tip: For even more refined output, you can use `awk`’s `printf` function for better formatting and alignment. For instance: `ps aux | awk ‘{printf “%-10s %-8s %-5s %-5s %s\n”, $1, $2, $3, $4, $11}’`
Linux Tips & Tricks | © ngelinux.com | 5/11/2026
