Posts Tagged ‘grep’

Faster grepping with fgrep

Thursday, March 15th, 2012 | Life, Tech

If you use the Unix terminal, you’re probably familiar with grep. It’s a great search tool. But sometimes it is a little slow. Luckily, there is a faster version, with the original name of fgrep, though you might be surprised to learn it doesn’t actually stand for fast grep. But don’t be confused – it is faster.

You use it in avery similar way to the way you would use grep. So for most occasions, simply replace grep with fgrep for faster results.

View all PHP scripts currently running

Friday, February 24th, 2012 | Life, Tech

Need to get a list of all the PHP scripts currently running? Actually, this technique works for everything, you just need to change the argument you pass to grep, but for the purpose of this example, I’m going to say we’re looking for PHP scripts.

ps aux | grep php

This will then produce a list of all the scripts. The ps aux command gives us a list of every processing running on the system. We then pass this through to grep and search for what we want – in this case processing which contain “php”.