Quick Tip
Taming `ps` Output: Focused Process Info with `awk`
Challenge: The output of the `ps` command can be overwhelming, making it difficult to quickly find specific process information like the exact command line or the user running a process.
The Solution: Leverage `awk` to filter and format `ps` output for precise information retrieval.
ps aux | awk '{if ($11 ~ /my_process_name/ || $2 == "1234") print $1, $2, $11}'
Why it works: `ps aux` provides a comprehensive process list. `awk` then filters lines where the 11th column (COMMAND) contains “my_process_name” OR the 2nd column (PID) is “1234”, and prints only the User, PID, and Command for clarity.
Pro-Tip: Use `ps -ef | awk ‘$1 == “username” {print $2, $8}’` to quickly list all processes owned by a specific user and their command names.
Linux Tips & Tricks | © ngelinux.com | 6/21/2026
