Quick Tip
Streamline `ps` Output with Custom `awk` Formatting
Challenge: The default output of the `ps` command can be overwhelming, making it difficult to quickly find the specific process information you need, such as CPU usage, memory consumption, or command arguments.
The Solution: Utilize `awk` to filter and format the `ps` output to display only the columns you’re interested in.
ps aux | awk '{print $1, $2, $4, $11}'
Why it works: This command pipes the full output of `ps aux` to `awk`. `awk` then processes each line, printing only the fields corresponding to user (1), PID (2), %CPU (4), and the command itself (11). You can adjust the numbers to include or exclude different fields based on your needs.
Pro-Tip: Use `ps -eo pid,ppid,%cpu,%mem,cmd` for a more direct and readable way to specify columns without relying on `awk` field numbers.
Linux Tips & Tricks | © ngelinux.com | 5/17/2026
