As someone who spends a lot of time working in the area of Search Engine Optimization (SEO), I find it very handy to be able to view the source code of webpages as googlebot would see them. Because I was always doing this, I created a handy alias in Terminal on OS X to do that very thing and I thought I’d share for anyone out there who’s interested. To create it open up a terminal window and type the following:
sudo pico /etc/bashrc
Now in the Pico editor add this line to the bottom of your file
alias googlebot='curl --no-sessionid --user-agent "Googlebot/2.1 (+http://www.googlebot.com/bot.html)"'
Use Control+X to exit and save, you will need to type in your password. Now close and restart Terminal. Now to view a webpage as Googlebot would see it type:
googlebot http://example.com/page.htm and voila!
This is very handy if you check websites for potential SEO problems and also to detect spam link injection hacks. (especially in WordPress)