How to generate and verify checksums on Linux

July 7, 2023 / Servers, Hosting & Email

This article explains how to generate and verify checksums on Linux. A checksum (hash) is an alphanumeric value that signifies the content of a file. It is generally used to confirm the truthfulness of files downloaded from any external source.

Follow the steps to generate checksums on Linux

  1. Log in to your account via SSH.
  2. Enter any one of the following commands at the command prompt by substituting filename with the name of the file you wish to generate a checksum.
  3. Execute the following command to generate an MD5 checksum:
    md5sum filename > md5sums.txt
  4. Generate an SHA checksum.
  5. To generate SHA-256 checksum, run the following command:
    Sha256sum filename > sha256sums.txt
  6. To generate SHA-512 checksum, run the below command:
    sha512sum filename > sha512sums.txt

Follow the steps to verify checksum on Linux

  1. Log in to your account through SSH.
  2. Depending on the algorithm (MD5 or SHA) that was used to generate the checksums, enter any one of the below commands in the command line. The filenames md5sums.txt and sha512sums.txt are used in these instances. Use that filename instead if you saved the checksums in a different file.
  3. Enter the commands-
  4. To verify MD5 checksums, enter:
    md5sum -c md5sums.txt
  5. To verify SHA checksums, enter:
    (To verify a SHA-256 checksum, use the sha256sum command. To verify a SHA-512 checksum, use sha512sum).

    sha512sum -c sha512sums.txt
  6. Matched checksum will display “Ok”, while unmatched checksum will display “Failed”.

This way, you can easily generate and verify checksums on Linux. Hope you liked our article. For more information on web hosting, do visit our KB section regularly.

Spread the love