How to get the MD5 sum of a file with the Linux command line and the md5sum command.

Posted: January 14, 2014. At: 10:17 AM. This was 4 years ago. Post ID: 6877
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

The md5sum command on Linux is used to get a number that is the checksum of the file. This is commonly used to verify downloaded files to check that the file has not been modified. Below is an example, the md5sum command is used on a BMP file and I get the file checksum output to STDOUT.

[homer@localhost Documents]$ md5sum manse.bmp 
089eac92c14a147ddb165784fa60b985  manse.bmp

If I then convert the image to a jpeg and then get the md5sum it will be different.

[homer@localhost Documents]$ convert manse.bmp manse.jpg

As shown here. Even a tiny change to the file will be shown as a different md5sum. It is practically impossible for a file to be changed and the md5sum to be the same number. Unless the new number just happens to be the same number after all. But the chances of that happening are extremely remote. This is possible, but remote with standard files. Read more here:

[homer@localhost Documents]$ md5sum manse.jpg 
726cd62d73183ac7cdc039d0f259130c  manse.jpg

No comments have been made. Use this form to start the conversation :)

Leave a Reply