Novell is now a part of Micro Focus

md5sum Checking for Verifying Downloads

Novell Cool Solutions: Trench
By Scott M. Morris

Digg This - Slashdot This

Posted: 25 May 2005

Transferring files is one of the most basic elements of networking. We download things from the Internet. We make backup copies of our data and transfer them to other machines. We email cute pictures of the baby to grandma. How can we know for sure if a file has been corrupted during the transfer? On proprietary operating systems, this is near impossible (in 12 years of using such operating systems, I never once heard of a way to do this).

For people using Linux, however, this is quite simple. We use a little command called md5sum.

Let's say you want to download the SUSE Linux Professional 9.3 Live DVD. You head over to the mirror list and select a mirror. Many sites that offer open source downloads will also offer a file called an "md5 sum." An md5 sum is kind of like a fingerprint of a file. It's uniqeness provides a way to check the integrity of the file that's been downloaded.

So, we click on the download link for the Live DVD and start that downloading. When it's all finished, we grab the md5 sum file also. Save both of these files in the same directory. When everything is downloaded, open up a terminal window. Change to the directory where the Live DVD image and md5 sum file are.

Now, we're ready to check to make sure the Live DVD image downloaded properly. View the contents of the md5 sum file with the cat command, as follows. MD5SUMS is the name of my md5 sum file:

[1702][smorris@linux:~/home]$ cat MD5SUMS
f200cfcd6e43a787ba7894585e14a721  README.txt
e7f56b1c7f2e6bde63b15699e114b98a  SL-9.3-LiveDVD-amd64-1.iso
1a78ae0591907f51af892cad2447fdae  SL-9.3-LiveDVD-i386-1.iso

Depending on which Live DVD image you downloaded, you will see what the md5 sum fingerprint should be there on the left.

Now, we need to determine what the md5 sum fingerprint actually is on the file we downloaded (mine is called SL-9.3-LiveDVD-i386-1.iso). This is done with the md5sum command, as follows:

[1705][smorris@linux:~/home]$ md5sum SL-9.3-LiveDVD-i386-1.iso
1a78ae0591907f51af892cad2447fdae  SL-9.3-LiveDVD-i386-1.iso

When you run this command, it will think for a minute or two and then give you the output. We can see that the file says that the md5 sum should be '1a78ae0591907f51af892cad2447fdae'. Based upon the output of the md5sum command, we see that the md5 sum of that file is indeed '1a78ae0591907f51af892cad2447fdae'. This means that the file was downloaded perfectly, and that no corruption has taken place.

If the md5 sums are different, you will know that the file got corrupted somehow when it was being downloaded.

This tool is great for verifying that you have transferred and/or downloaded files successfully without any data corruption. It also comes in handy as a troubleshooting tool. If you want to check file integrity when transferring files, md5sum is a sweet way to go.

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates