Quick Tip
Tame Your Processes: Focused `ps` Output with `awk`
Challenge: The standard `ps` command can produce a lot of information, making it difficult to quickly find specific process details 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 output of `ps` for targeted information extraction.
ps aux | awk '{print $1, $2, $4, $11}'
Why it works: This command pipes the comprehensive output of `ps aux` to `awk`. `awk` then processes each line, printing only the columns corresponding to USER (1), PID (2), %CPU (4), and COMMAND (11). You can easily adjust these column numbers to display different `ps` fields.
Pro-Tip: To filter for a specific process, you can add a condition within awk, e.g., `ps aux | awk ‘/my_process_name/ {print $1, $2, $4, $11}’` to only show lines containing “my_process_name”.
Linux Tips & Tricks | © ngelinux.com | 5/18/2026
