Taming `ps` Output: Focused Process Info with `awk`
Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The output of the `ps` command can be overwhelming, showing a lot of information about running processes. Often, you only need a specific piece of data, like the process ID (PID) or the command name, to manage or troubleshoot a process.
The Solution: Use `awk` to filter and format the output of `ps` to display only the columns you need.
ps aux | awk '{print $1, $2, $11}'
Why it works: The `ps aux` command provides a detailed snapshot of all running processes. Piping this output to `awk` allows us to specify which fields (columns) to print. In this example, `$1` is the USER, `$2` is the PID, and `$11` is the COMMAND, giving you a cleaner, more targeted view.
Pro-Tip: To find the PID of a specific process, combine `grep` with `awk`: ps aux | grep 'my_process_name' | awk '{print $2}'
Linux Tips & Tricks | © ngelinux.com | 6/2/2026
