Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The output of the `ps` command can be overwhelmingly verbose, making it difficult to quickly find specific process information like PID, CPU usage, or memory consumption.
The Solution: Combine `ps` with `awk` to filter and display only the columns you need.
ps aux | awk 'NR==1 || $1 ~ /your_username/ {print $1, $2, $3, $4, $11}'
Why it works: `awk` processes the output line by line. `NR==1` prints the header row, and `$1 ~ /your_username/` filters for lines where the first column (username) matches your username. The `{print …}` part specifies which columns (username, PID, %CPU, %MEM, and command name) to display.
Pro-Tip: Replace `$1 ~ /your_username/` with `$2 ~ /your_pid/` to filter by a specific PID, or use `$11 ~ /process_name/` to filter by process name.
Linux Tips & Tricks | © ngelinux.com | 6/6/2026
