Dynamically filter Linux processes if you do not have htop

Linux `htop` rocks when you want to filter through the list of running Linux processes, for instance to watch httpd processes only. However, not all servers have htop installed.

So what you could do is simply use `top` and pipe it through `grep`, right? Something like

top | grep sql

Yeah, that would work... but it does not show column headings, which makes it hard to read. pgrep to the rescue! This snippet will grep the top list for 'sql', displaying the column headings as well. Make sure to copy the backticks!

top -p `pgrep -d "," sql`

You can use Ctrl+C to escape.

pgrep output