How To Check MD5 Checksum of a File

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 4 - 8
  • Microsoft Windows (optional)

Issue

  • How do I verify the integrity of a file with md5sum?

Resolution

  • To print the md5 checksum to the console.

    $ md5sum filetocheck
    
  • Verify that the alpah-numeric string that was printed to the console matches the md5 hash that was provided with the file.

  • To verify md5 checksum from a file.

    $ md5sum -c hash.md5
    
  • The program will print the filename and OK if verified to the console. The file format should be a hash(two spaces)filename.

    $ cat hash.md5
    a84d4d9eddb36fb417832166cd10a4c2  rhel-server-6.5-x86_64-dvd.iso
    ...
    004a37b1b0269992a3b341b8f7c3a579  boot.iso  
    

Red Hat Enterprise Linux 9 and above

Windows

  • To check an md5sum on a Windows machine, you can use the certutil program as follows:

    First press Win+R and run "cmd", then:

    certutil -hashfile filetocheck MD5
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments