Tag Archives: linux

Shell Script to Detect If the IP Address Is Googlebot

1. Introduction

Google has explained here on how to verify if the given IP belongs to Googlebot. So instead of hard-coding all the IPs which might change eventually, Google has suggested doing a DNS lookup using host command on Linux. The steps suggested in the article are:

  1. reverse DNS lookup using the IP to get domain name
  2. check if the domain name contains googlebot.com or google.com. The types of bots and their names can be found here.
  3. forward DNS lookup using the domain name obtained in step 1 to get the IP and verify that this IP is same as the IP you initially started with.

2. Implementation Approach

And I wanted to check if the IPs ( I had around 45) belonged to google bot. One option was to run host for each of the IPs, as suggested in the above steps, but this was practically not possible and if possible it would be time-consuming. So I came up with a simple shell script to do this job.

  1. reverse DNS lookup to get the domain name
    #hostName is the complete domain name
    hostName = host $line | cut -d" " -f 5

    So a sample response of host command would be domain name pointer crawl-66-249-66-246.googlebot.com. And we can extract the domain name using the cut command as shown above. This gives us hostName = crawl-66-249-66-246.googlebot.com.

  2. forward DNS lookup to get the IP
    hostIp=host $hostName | cut -d" " -f 4

    A sample response to the host command, in this case, would be: crawl-66-249-66-246.googlebot.com has address And we extract the IP using the cut command shown above which gives us the hostIp =

  3. verify the domain name to contain googlebot and the IP obtained in step 2 is same as the IP we started with in step 1
    if [ $line == $hostIp ] && [ $domainName == "googlebot.com" ]
        echo "Googlebot: $hostIp -> $hostName"

3. Complete Shell Script

Let the IPs be in the file googlebots, for example, let us add these IPs:

The shell script is given below:

while read -r line
    hostName=`host $line | cut -d" " -f 5`
    domainName=`echo $hostName | cut -d"." -f2,3`
    #echo $domainName
    #echo "$hostName"
    hostIp=`host $hostName | cut -d" " -f 4`
    #echo "$hostIp"
    if [ $line == $hostIp ] && [ $domainName == "googlebot.com" ]
        echo "Googlebot: $hostIp -> $hostName"
done < "$file"

Accessing Linux Files from Windows Simplified- Ext2 installable File System

People using dual boot with Windows and Linux and have data spread across different partitions on Linux and TuxWindows will have/are faced/facing the problem of inablity to access files on Linux partitions from Windows. I was using Ubuntu 8.04 extensively some days back before facing some problems which i need to correct. And I was using Azureus for downloading movies from torrents and i found it pretty fast on Ubuntu when compared to Windows where i was using uTorrent. I was impressed by the Axxo torrents, the clarit of video and audio was just perfect and that to for a mere 699 MB. So i had some 8 movies on my Linux ext3 partition and when ever i was on Windows and thought of watching them, i had to reboot into Ubuntu and then watch them- this was really irritating. But the other day i found a blog post in Ubuntu Geek where he had listed some tools for accessing files on u’r Linux partitions from Windows. There were many and i randomly chose Ext2 Installable File System. The installation was pretty quick and there were no hassels. At the end of the installation i was prompted for drive letters for the Linux ext3 partition and the swap partition. I chose U: for ubuntu and z: for swap.

One can download the software here.

Bookmark and Share

Open Source at Microsoft

For people who are parallely interested in Open source but cannot do away with Microsoft, here’s a great resource-


What is CodePlex?

CodePlex is Microsoft’s open source project hosting web site. You can use CodePlex to create new projects to share with the world, join others who have already started their own projects, or use the applications on this site and provide feedback.


There’s another blog PORT25, Communications from the Open Source Community @ Microsoft. Port 25 is about having a healthy conversation with customers and the industry wherein people can talk openly and honestly about their biggest interoperability challenges, whether it is on UNIX, Linux, Windows, or among other open source packages.

Open Source – It happening everywhere, in some form or the other 🙂

Tomboy-Panel for quick access of notes


The Ubuntu desktop comes preloaded with a fantastic note-taking application called Tomboy.

While the application can be easily accessed from the desktop Applications menu (under the Accessories sub-menu), it can me cumbersome to have to remember to launch this application each time a desktop session is started.

Fortunately, the tomboy application can be added to the desktop panel in a convenient form. Just right click on an empty area of the panel, and choose Add To Panel. In the resulting window, under the Accessories section, find and double click the Tomboy Notes. Now you should have a little notepad icon in your desktop panel. Click on this icon to access all your notes instantly, or to create new notes.

Using this method will also ensure that the Tomboy application gets added to your panel on every startup, ensuring that you’ll always have quick access to your notes.

addrepo – Easiest way to add APT repositories

addrepo is a simple command line interface for easily adding APT repositories to your sources.list

Install addrepo in Ubuntu

This is very simple process just use the following two commands

sudo wget http://mac4deb.googlepages.com/addrepo -O /usr/bin/addrepo

sudo chmod +x /usr/bin/addrepo

Using addrepo

addrepo [repository]

Now you just replace ‘[repository]’ with a repository name

addrepo example

addrepo deb http://dl.google.com/linux/deb/ stable non-free

It already includes ’sudo,’ so adding sudo before you enter the command is not necessary.

Commands Recap

sudo wget http://mac4deb.googlepages.com/addrepo -O /usr/bin/addrepo

sudo chmod +x /usr/bin/addrepo