Taming `ps` Output with Custom `awk` Formatting

Quick Tip

Taming `ps` Output with Custom `awk` Formatting

Challenge: The default output of the `ps` command can be overwhelming, showing a lot of information you might not need. It’s hard to quickly find specific processes based on limited criteria or to format the output for easier reading.

The Solution: Leverage `awk` to filter and format the output of `ps` for precisely the information you need.

ps aux | awk '$1 == "your_user" && /your_process_name/ { print $2, $11 }'

Why it works: `ps aux` lists all processes with user, PID, and command. `awk` then filters these lines, printing only the PID (column 2) and command name (column 11) for processes owned by “your_user” that contain “your_process_name”.

Pro-Tip: Use `ps -eo pid,ppid,cmd,%cpu,%mem –sort=-%cpu | head -n 10` to see the top 10 CPU-consuming processes.

Linux Tips & Tricks | © ngelinux.com | 5/6/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments