How to text search in terminal

There’re times when I need to quickly search through occurrences of certain phrases in my PHP source files. Here is when I have to search for ‘giraffes’.

This is an example finding the word ‘giraffes’ in all PHP source files from the current directory recursively.

[code lang=”bash”]find . -name “*.php” -exec grep -i -H -n “giraffes” {} ;[/code]

This works for Ubuntu, CentOS and Mac OS X.

How to make Terminal start faster

This always annoys me. Mac OS X’s Terminal’s prompt not loading promptly.

Sometimes it is something to do with Apple system logs. You can clear them through this:

sudo rm -f /private/var/log/asl/*

It works for me and I’m a happy user again, now the prompt in Terminal starts quickly when I start a new Terminal tab. Hope it helps.