Taming `ps` Output: Focused Process Info with `awk`
Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The `ps` command often outputs a lot of information, making it difficult to quickly find specific process details like CPU usage, memory, or the full command line. You might need to sift through numerous columns to get what you need.
The Solution: Use `awk` to select and format specific columns from the `ps` output.
ps aux | awk '{print $1, $2, $4, $11}'
Why it works: `awk` processes the output line by line and allows you to specify which fields (columns) to print. In this example, `$1` is USER, `$2` is PID, `$4` is %CPU, and `$11` is the COMMAND. You can adjust these field numbers and the `print` statement to customize the output to your needs.
Pro-Tip: To see only processes owned by a specific user, you can add a condition to `awk`: ps aux | awk -v user="your_username" '$1 == user {print $1, $2, $4, $11}'
Linux Tips & Tricks | © ngelinux.com | 5/20/2026
