Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The default output of the `ps` command can be overwhelming when you’re trying to find specific process information. You might be looking for just the PID and command name, or perhaps CPU and memory usage for a particular process.
The Solution: Combine `ps` with `awk` to precisely select and format the output you need.
ps aux | awk '{print $2, $11}'
Why it works: `ps aux` provides a comprehensive list of running processes with user, CPU, memory, and command details. `awk` then processes this output line by line, printing only the second field (PID) and the eleventh field (command name) for each process.
Pro-Tip: To see CPU and memory usage along with the command, try: ps aux | awk '{print $2, $3, $4, $11}'
Linux Tips & Tricks | © ngelinux.com | 5/25/2026
