How to create MD5 Checksums and validate a file in Linux

This article will explain how to generate a MD5 Checksum on a file or list of filesa and also how to validate a file against a known MD5 Checksum. For those of you that are not familiar with MD5 Checksums, the purpose is to validate the integrity of a file that may have been corrupted or tampered with. For example, it is possible for file to be corrupted in the process of downloading it from a website or FTP server. In order to verify if it has been corrupted or not, the publisher of the file you downloaded can include a MD5 Checksum (a string of numbers of letters) which is compared to the file you just downloaded. If the two checksums match, that means the files are identical – no corruption has occurred.  Now lets take a look at some examples.

Generate MD5 Checksum on a single file

md5sum filename

Generate MD5 Checksum on multiple files

md5sum filename1 filename2 filename3

Generate MD5 Checksum and ouptut to file

md5sum filename > md5.txt

Compare MD5 Checkum output file to current file in directory

md5sum -c md5.txt

Example of what a MD5 Checksum looks like

d4fdb933151cad1eb58e798d2874f8f6 send_file-1.0.0.7-0.i386.rpm


{ 1 Comments }
  1. Thanks, very helpful!

Please post your comments/suggestions!