Monday, June 22, 2009

Hyper terminal for linux

For people that manage hardware devices such as storage, routers and many more using Microsoft Windows, the term hyper terminal is a familiar thing. They use hyper terminal to connect to all the devices mentioned above using serial cable. But what if you have to manage all those devices using linux?

The answer is, linux has 2 alternatives to hyper terminal; one is command line based and the other is GUI based. Let me start with the command line tool first. It is called minicom. You can install this tool using package manager of your linux machine. In fedora/redhat/centos:

# yum install minicom

Running it for the first time requires you to do some settings by running below command as root:

# minicom -s

Picture below shows the screen after command minicom -s

This is where you set the baudrate, serial device you want to use etc. After finish with the setting, save it so that you do not have to do it every time. You can save it to default .dfl file, with the name of .minirc.dfl in your home folder, or you can specify the name and location yourselves. To change the saved setting, just use the above command back.

The second tool is called cutecom, a graphical serial terminal. To install it on fedora,centos or redhat:

# yum install cutecom

It is easier to use since it has GUI. Picture below shows cutecom main screen, where you can set your device, parity, baudrate etc.

Monday, June 15, 2009

Validate your downloaded files using md5

When you download files, especially iso for your favourite linux distro, how do you validate the files is properly downloaded or not? This is where md5 checksum comes into picture. From manpage of md5sum; md5sum is used to compute and check MD5 message digest. What is MD5 exactly?

"MD5 is a widely used cryptographic hash function with a 128-bit hash value. As an Internet standard (RFC 1321), MD5 has been employed in a wide variety of security applications, and is also commonly used to check the integrity of files. However, it has been shown that MD5 is not collision resistant; as such, MD5 is not suitable for applications like SSL certificates or digital signatures that rely on this property. An MD5 hash is typically expressed as a 32 digit hexadecimal number "

The above definition is extracted from

To make it simple, the usage to this magnificent tool is just to validate the correctness of any file that we download from the internet. This is very important especially when we downloaded big files such as linux distro iso so that we won't burn a corrupted iso. The easiest way to check the correctness of the iso is by using md5sum

How to use:

to check the md5sum of a file
$ md5sum filename


Lets say we have a file named test.txt. Run the md5sum command to this file:
$ md5sum test.txt

Compare the string that we got with the md5 string provided by the provider of the file. If similar, test.txt is in good order.

If you have more than one file to be checked, use flag -c to check from file. Example, we have 2 files, test.txt and test2.txt, and we want to check both using md5 validation. First, create a file that follow the format where first column is for md5 string, then 2 spaces(press spacebar 2 times) and the next column is the name of the file like below:

d968a9cf53f4cb21b06a888e2a6f4cb6 test.txt
52dba85eb1460f265ddf3de51e91652a test2.txt

Save the file as md5sum.txt

Place the md5sum.txt with test.txt and test2.txt in a same folder

Run md5sum command to check:
$ md5sum -c md5sum.txt

If success, the output will be like this:

test.txt OK
test2.txt OK

You are done with the testing and test.txt and test2.txt is validated as correct using MD5 checksum :)