Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The standard `ps` command provides a wealth of information about running processes, but often it’s too much to sift through when you need specific details quickly. You might want to see only the process ID (PID) and command name for a particular user, or sort processes by memory usage.
The Solution: Combine `ps` with `awk` to filter and format process output to your exact needs.
ps aux | awk '{print $1, $2, $11}' # Shows User, PID, and Command
Why it works: `ps aux` lists all running processes in a detailed format. `awk` is a powerful text-processing tool that can parse lines based on columns (fields). By specifying `'{print $1, $2, $11}’`, we tell `awk` to print the first, second, and eleventh fields, which typically correspond to the username, PID, and the command name, respectively.
Pro-Tip: To see only processes owned by a specific user, you can add another `awk` condition: ps aux | awk '/^myuser/ {print $1, $2, $11}' where ‘myuser’ is the username you’re interested in.
Linux Tips & Tricks | © ngelinux.com | 6/27/2026
