Streamline `ps` Output with Custom `awk` Formatting
Quick Tip
Streamline `ps` Output with Custom `awk` Formatting
Challenge: The default output of the `ps` command can be verbose and sometimes difficult to parse for the specific process information you need. You might want to quickly see only the PID, user, and command name.
The Solution: Leverage `awk` to filter and format the `ps` command’s output.
ps aux | awk '{print $2, $1, $11}'
Why it works: The `ps aux` command provides a comprehensive list of running processes. `awk` then processes this output line by line, printing only the second field (PID), the first field (USER), and the eleventh field (COMMAND) for each process, creating a concise and focused view.
Pro-Tip: You can easily customize the fields you display by changing the numbers within the curly braces of the `awk` command (e.g., `$2, $1, $4` to see PID, USER, and %CPU).
Linux Tips & Tricks | © ngelinux.com | 5/31/2026
