How do I setup round robin DNS?

Posted on in Categories , , , , , last updated September 13, 2007

Round robin DNS is a technique in which load balancing is performed by a DNS server instead of a strictly dedicated machine. A DNS record has more than one value IP address.

When a request is made to the DNS server which serves this record, the answer it gives alternates for each request. For instance, if you had a three webserver that you wished to distribute requests between, you could setup your DNS zone as follows:

Open your zone file using vi text editor and add/modify www entry as follows:
# vi
Append/modfiy www entry:

www   IN   A
          IN   A
          IN   A
         IN   A

Save and restart BIND9. If you run nslookup for

# nslookup



One more time:
# nslookup


When a query is made to the DNS server it will first give the IP of for the www host. The next time a request is made for the IP of www, it will serve and so on.

The order in which IP addresses from the list are returned is the basis of the round robin name. While this is a form of load balancing, it should be noted that if one of the hosts becomes unavailable, the DNS server does not know this, and will still continue to give out the IP of the downed server.

Open / view .chm file under Linux or FreeBSD

Posted on in Categories , , , , , last updated January 22, 2007

Chm file is a Microsoft Compressed HTML Help file in a proprietary format for online help files. Under Linux/FreeBSD or UNIX you can open .chm file using following three different programs which makes it possible to browse native Windows CHM files:

Install chm viewer

Use apt-get or yum command to install chm viewer:
# apt-get install gnochm
# apt-get install kchmviewer

Gnome Desktop User

Use gnochm program as follows
$ gnochm file.chm

KDE Desktop User

Use kchmviewer (very nice and highly recommended) program as follows
$ kchmviewer file.chm

Other tool

xchm program is quite outdated but works:
$ xchm file.chm

Howto Open a PDF file under Linux / FreeBSD

Posted on in Categories , , , , , , last updated March 26, 2008

PDF is an acronym for Portable Document Format. It is a proprietary file format developed by Adobe Systems for representing two-dimensional documents in a device independent and resolution independent format. You can open pdf file using graphical as well as command line tools (i.e. without GUI). Linux supports following PDF viewer under X window:

  • Gnome pdf viewer (gpdf)
  • KDE pdf viewer (kpdf)
  • xpdf
  • Official Adobe acrobat reader

Graphic pdf viewer under Linux/FreeBSD

If you are using Gnome desktop…

Open a shell prompt and type the command:
$ gpdf file.pdf
$ evince file.pdf

If you are using KDE desktop…

Open a shell prompt and type the command:
$ kpdf file.pdf

You can also click on K icon > Select Graphics > Select PDF viewer

Console pdf viewer under Linux/FreeBSD

Console pdf viewer

As far as I know there is no console based PDF viewer exists. But you can use the following trick to open a PDF file:

a) First install pdftohtml – A command-line tool for converting pdf-files into html and other formats.

Debian User install pdftohtml using following command:
# apt-get install pdftohtml
Red Hat / Fedora user install pdftohtml using following command:
# yum install pdftohtml
FreeBSD user install pdftohtml using following command:
# pkg_add -v -r pdftohtml
OR use ports collection:
# cd /usr/ports/textproc/pdftohtml
# make; make install

The idea is very simple you will use a pdftohtml program to convert a PDF file into html, xml and png images and then display them using text browser such as elinks or lynx. This is useful when you works on remote server or if GUI is not available:
For example to convert CH09.PDF file you need to type the following set of commands:
$ pdftohtml CH09.PDF
$ lynx CH09.html

$ elinks CH09.html

You can also convert a PDF file to text file using following command:
$ pdftotext CH09.pdf
$ vi CH09.txt

See also

=> You can get Official Adobe acrobat reader here for UNIX/Linux oses.

Linux how do I remove all empty directories?

Posted on in Categories , , , , , , , , last updated February 2, 2007

You can use program called cleanlinks. The cleanlinks program searches the directory tree descended from the current directory for symbolic links whose targets do not exist, and removes them. It then removes all empty directories in that directory tree. It was originally created for symbolic links based directories but works with normal directories too.

For example if you want to remove all empty directories from /tmp directory, type the command:
$ cd /tmp
$ cleanlinks

Please note that cleanlinks command is part of XFree86 project. Another method is to use combination of shell commands in script:

 [ -d $DIR ] && [ $(ls -l $DIR | wc -l) -eq 1  ] && rmdir $DIR ||  :

Save and execute a script:
$ dir1

You can also try out tmpreaper command which recursively searches for and removes files and empty directories which haven’t been accessed for a given number of seconds. Normally, it’s used to clean up directories which are used for temporary holding space, such as “/tmp”. Syntax is as follows:


  • TIME-FORMAT : Defines the age threshold for removing files. The TIME-FORMAT should be a number, defaulting to hours, optionally suffixed by one character: d for days, h for hours, m for minutes, or s for seconds.
  • DIRS : Directory name for example /tmp

For example, remove all files accessed 24h before:

# tmpreaper 24h /tmp

Please note that tmpreaper command is not installed by default you may need to install it using apt-get or rpm command.