Tag Archives: linux

Shell Script to Detect If the IP Address Is Googlebot

Recently I wanted to check if the IPs ( I had around 45) belonged to google bot. One option was to run host <ip> and host <domain name> for each of the IPs, 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.

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

66.249.66.246
66.249.66.97
66.249.64.12

The shell script is given below:

#!/bin/sh
file="googlebots"
while read -r line
do
    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" ]
    then
        echo "Googlebot: $hostIp -> $hostName"
    fi
done < "$file"
Advertisements

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-

CodePlex:

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.

PORT25:

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

TomboyTomboy

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