Quick Tip
Taming `ps` Output with Custom `awk` Formatting
Challenge: The default output of the `ps` command can be verbose and difficult to parse when you need specific process information quickly. Filtering and selecting specific columns manually can be tedious.
The Solution: Leverage `awk` to precisely select and format the columns you need from the `ps` command output.
ps aux | awk '{print $1, $2, $3, $4, $11}'
Why it works: `ps aux` provides a comprehensive list of running processes. `awk` then acts as a powerful text-processing tool, allowing you to specify which fields (columns) to print. In this example, `$1` is USER, `$2` is PID, `$3` is %CPU, `$4` is %MEM, and `$11` is COMMAND. You can adjust these numbers to display any columns you need.
Pro-Tip: To filter by process name, you can add a condition like ps aux | awk '/nginx/ {print $1, $2, $3, $4, $11}' to only show lines containing “nginx”.
Linux Tips & Tricks | © ngelinux.com | 5/12/2026
