How to check file integrity using md5sum

| | 2 min read

md5sum stands for message digest version 5, which is used to check file integrity whether the transferred files are corrupted or not. md5 is a command line utility used in both LINUX or MS-DOS/WINDOWS which generates and verifies message digests using the md5 algorithm. The md5 hash comparison detects changes in files that would cause errors. The possibility of errors is proportional to the size of the file. The possibility of errors will increase with the increase in size of the file.

The main use of md5sum comes into place when dealing with operating system installation. When you have a file like an operating system installation CD, it should be fully correct. Most Linux distributions come with the md5sum utility so its installation is usually not necessary.

We have used the md5sum for checking the the data backup from the server. For this we have to calculate the md5sum value of the data that is to be transferred and note the hexadecimal value obtained as output for the md5sum. Now after transferring the data that are after downloading the whole data from the server, use the md5sum and note down the hexadecimal value obtained as output. Now check the md5sum value before and after download. If both the values are same then the file is not corrupted, that is the transferred file is same as the received file. But if the md5sum values are different then the files are different, that is the file transferred is not the file received.

How to check the ISO file

  1. Open a terminal and go to the directory to check a downloaded ISO file.
    user@user:~$ cd Downloads/
  2. Run the command from the within the Download directory.
    user@user:~$ md5sum ubuntu-10.04.4-desktop-amd64.iso
  3. md5sum will print a single line after calculating the hash.
    1c0feea62a3ab961a90dad75c6990d21 ubuntu-10.04.4-desktop-amd64.iso

Now the hash value is obtained and we will verify it with the previous hash value so as to know whether the ISO file file is corrupted or not.