How it works...

The syntax for the md5sum checksum calculation is as follows:

$ md5sum file1 file2 file3 ..

When multiple files are used, the output will contain a checksum for each of the files, one checksum report per line:

[checksum1]   file1
[checksum1]   file2
[checksum1]   file3

The integrity of a file can be verified with the generated file, like this:

$ md5sum -c file_sum.md5
# It will output a message whether checksum matches or not

If we need to check all the files using all .md5 information available, use this:

$ md5sum -c *.md5

SHA-1 is another commonly used checksum algorithm. It generates a 40-character hex code from the input. The sha1sum command calculates an SHA-1 checksum. Its usage is similar to md5sum. Simply replace md5sum with sha1sum in all the commands previously mentioned. Instead of file_sum.md5, change the output filename to file_sum.sha1.

Checksums are useful to verify the integrity of files downloaded from the Internet. ISO images are susceptible to erroneous bits. A few wrong bits and the ISO may be unreadable, or, worse, it might install applications that fail in strange ways. Most file repositories include an md5 or sha1 file you can use to verify that files were downloaded correctly.

This is the MD5 sum checksum that is created:

3f50877c05121f7fd8544bef2d722824 *ubuntu-16.10-desktop-amd64.iso
e9e9a6c6b3c8c265788f4e726af25994 *ubuntu-16.10-desktop-i386.iso
7d6de832aee348bacc894f0a2ab1170d *ubuntu-16.10-server-amd64.iso
e532cfbc738876b353c7c9943d872606 *ubuntu-16.10-server-i386.iso