Home > Linux > How To Verify MD5 Checksum File in Linux Image (ISO) using Command Line

How To Verify MD5 Checksum File in Linux Image (ISO) using Command Line

What is Checksum in Linux?

This post is aimed to explain the concept of Checksum (md5, sha256, & sha -1). The use of checksum in Linux & why it is used.

What is Checksum in Linux?

Checksum is a digital identity of a file. In other words you can say that Checksum is small size unit of data in a block of digital data to detect any error while the file is transmitted through a network or after it is stored.

To deepen your understanding for checksum, it is a long string of data which contains letters & numbers. These are used when you download a file from a network. For ex:- Linux distribution image, software packages etc.

Use of Checksum

The most common use of checksum is to check whether a downloaded file is corrupted.

For example the download page of Ubuntu places a SHA256 checksum for every ISO file available there. After your image is downloaded, generate a SHA256 checksum & verify the checksum to match the value mentioned in the site of Ubuntu.

What is Checksum in Linux?
What is Checksum in Linux?

If the value is not matched , then your version of downloaded file is corrupted during the download process.

How is Checksum generated?

Checksum is generated by Checksum algorithm. Think it as an input of a file & the output is checksum value of the file.There are multiple algorithms for generating checksum , the most popular algorithms are

  • Secure Hash Algorithms and variants (SHA-1, SHA-2 etc.) and
  • MD5 Algorithm

How to use checksum using GUI for a file

By using a GUI method, you can use GtkHash.

GtkHash is a nifty tool to generate & verify checksum. It supports a wide range of checksum algorithms. like algorithms – including SHA, MD5 and others. Here’s a list of supported algorithms:

  • MD2
  • MD4
  • MD5
  • MD6-224
  • MD6-256
  • SHA1
  • SHA256
  • TIGER128
  • HAVAL 128-3
  • ADLER32
  • SNEFRU256

How to Instal GtkHash on Ubuntu / Kali Linux

To install GtkHash on your Ubuntu system, run this command in your terminal.
sudo apt install gtkhash

& its done.

For selecting the checksum algorithms to use:

  • Go to Edit > Preferences menu option.
  • Select the ones you would like to use.
  • Hit Close button.

By default – MD5, SHA-1 and SHA256 is selected.

Using GtkHash

Using it is quite straight-forward.

  • Select the file you want to check
  • Get the Checksum value from the website and put it in Check box.
  • Click the Hash button.
  • This will generate the checksum values with the algorithms you selected.
  • If any one of them matches with the Check box, it will show a small tick sign beside it.

Here’s an example showing GtkHash generating checksum for UbuntuMATE iso image (ubuntu-mate-16.10-desktop-amd64.iso)

Command Line Checksum Tools

Linux distributions come with tools for checksum algorithms. The generation & verification of checksum can be done by them. The tools for the command-line checksum are :-

  • md5sum :- MD5 checksum tool
  • sha1sum :- SHA-1 checksum tool
  • sha256sum :- SHA-256 checksum tool

There are many more like this i.e. sha224sum, sha384sum etc. All uses sha256sum. We are using ubuntu-mate-16.10-desktop-amd64.iso” file for it.

Generating and Verifying SHA256 Checksum with sha256sum

Go to the directory where the .iso is saved.

cd ~/techbud

To generate SHA256 checksum, enter the command.

sha256sum ubuntu-mate-16.10-desktop-amd64.iso

This command will show the checksum on the terminal window.

Generating SHA256 Checksum for an ISO File

If the checksum generated matches with the provided in the Ubuntu MATE website, then your file is correctly downloaded.If the value is not same, then your file is corrupted & you have to download it again.Other tools like this are same.

 

Working of Checksum

The checksum are very delicate to work in the same. They are designed to check the corrupted files. If just one character in a file is changed, then the resultant checksum will be different from the good file.

The checksum is an effective way to check for a corrupted file.

If you have installed Linux after using the checksum, then its good. But if you haven’t , then have you faced any problem while installing the Linux OS.

That’s it for now. if you like this article, then please give your feedback in the comment sections. Don’t forget to share this with your friends. Thanks You.

Vanshanu raj
Vanshanu Raj is Computer Science Graduate from College of Engineering Roorkee & a Diploma Holder from Government Polytechnic Dehradun. He Made this site to to aware people with Open Source Software & their uses.

Leave a Reply

Your email address will not be published. Required fields are marked *