Quick Tip
Supercharge Your `ps` Output with Custom `awk` Formatting
Challenge: The standard output of the `ps` command can be overwhelming, making it difficult to quickly find the specific process information you need. You often want to see only a few key details like PID, CPU usage, and command name.
The Solution: Use `ps aux` combined with `awk` to filter and format the output.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: `ps aux` provides a comprehensive list of running processes. `awk` then processes this output line by line, printing only the specified fields (user, PID, %CPU, %MEM, and command). Each column in the `ps` output corresponds to a specific field number that `awk` can access.
Pro-Tip: For even more tailored output, you can use `awk`’s conditional statements. For example, to see only processes using more than 5% CPU: ps aux | awk '$3 > 5 {print $1, $2, $3, $11}'
Linux Tips & Tricks | © ngelinux.com | 5/14/2026
