Command Line Tip - Verify Downloaded Files

CD image - source http://www.sxc.hu/photo/1015749

Ever wondered what that MD5sum and SHA1sum things are when you are downloading ISO images? Whether it's a Linux distro, or any other file, you might have seen these 'checksums' floating around.

Their purpose is to allow you to verify that you have a complete and uncorrupted copy of a file. If you can generate the same checksum with your copy of the file, then the file must be a true copy.

So, how do you verify these checksums?


For Windows users

Windows users - you need to first download both md5sum.exe and sha1sum.exe from the CentOS dostools page. Once they've downloaded, copy them to C:\WINDOWS\system32 (so you can use them from the command line without typing the whole path).


Pretty simple. Open up your command line terminal - usually in Accessories or System Tools on Linux. Windows users - you'll want to do Start > Run > cmd.exe > OK.

Then simply type either md5sum or sha1sum, followed by the full path to the downloaded file.

For example, if I want to verify the MD5 of ubuntu-8.04.1-desktop-i386.iso stored in /home/peter/Downloads, I'd do this:

md5sum /home/peter/Downloads/ubuntu-8.04.1-desktop-i386.iso

Similarly, to check the SHA1 sum:

sha1sum /home/peter/Downloads/ubuntu-8.04.1-desktop-i386.iso

After some calculation, which might take a while depending on file size, you'll get a checksum of your own. Compare this to the one listed on the website you downloaded from.

If the two checksums match, your copy is complete and true. Burn with confidence!

Windows users - your paths will look something more like: md5sum "C:\Documents and Settings\Peter\My Documents\Downloads\ubuntu-8.04.1-desktop-i386.iso". It's just the same idea, though!

[image source]

Avatar for peter Peter Upfold - http://peter.upfold.org.uk/

Peter Upfold is a technology enthusiast from the UK. Peter’s interest in Linux stems back to 2003, when curiosity got the better of him and he began using SUSE 9.0. Now he runs Linux Mint 9 on the desktop, runs a CentOS-based web server from home for his personal website and dabbles in all sorts of technology things across the Windows, Mac and open source worlds.

Home » Articles »

Discussion: Command Line Tip - Verify Downloaded Files

Home » Articles » Command Line Tip - Verify Downloaded Files