md5sum

6.5 md5sum: Print or check MD5 digests

md5sum computes a 128-bit checksum (or fingerprint or message-digest) for each specified file.

Syntax :

md5sum [OPTION]... [FILE]...
$ md5sum index.png
4191736479ed247941e1bf20830618ad  index.png

Command usage examples with options :

Example 1: Store the MD5 checksum in file and then verify it.

$ md5sum /home/mandeep/test/test.cpp > checkmd5.md5

It will store the MD5 checksum for test.cpp in file checkmd5.md5

$ md5sum -c checkmd5.md5

It will verify the contents of file

Output :

/home/mandeep/test/test.cpp: OK

After changing the contents of file checkmd5.md5, the output will be :

/home/mandeep/test/test.cpp: FAILED
md5sum: WARNING: 1 computed checksum did NOT match