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 CPU usage, memory consumption, or the full command line for a particular process.
The Solution: Leverage the power of `awk` to filter and format the `ps` output to display only the columns you need, creating a more readable and actionable view.
ps aux | awk '{print $1, $2, $4, $11}'
Why it works: This command pipes the output of `ps aux` (which provides a comprehensive list of processes) to `awk`. `awk` then processes each line, printing only the fields corresponding to the User (column 1), PID (column 2), %CPU (column 4), and Command (column 11). You can easily adjust the column numbers to display any combination of `ps` output fields.
Pro-Tip: To display the full command line of a process, use `ps aux | awk ‘{print $1, $2, $4, $11}’` and if the command is truncated, you might need to experiment with different `ps` options and `awk` field positions, or consider using `ps -efww` for a wider output and adjust your `awk` fields accordingly.
Linux Tips & Tricks | © ngelinux.com | 6/1/2026
