In this post we will be looking at running top in batch mode, looking for a string with grep, grabbing the process id's with awk and sending the process id's to be processed by another command with xargs.

For speed, I have just set up a quick VPS and installed apache.

top in batch mode

top -b -n1

This command with do as it suggests run top in batch mode with the -b switch, the -n1 tells it to run 1 time, -n5 would be 5 times.

Looking for a string with grep

We can pipe the out...