Verify checksum in Ubuntu

Published: June 03, 2022

Verify checksum in Ubuntu

In this article, we would cover how to verify checksum in Ubuntu. With the help of a checksum we can identify whether the data we have stored in the memory is still valid or not. For that, we need to first know the checksum of the data and store it. Later, if we want to check whether the data is still valid or not, we need to recalculate the checksum for the stored data again. If the recalculated checksum and the checksum we calculated for the first time matches. Then, stored data is still valid. In other words, we can say if the checksum matches then there the no errors in the stored data.

Checksum is basically used to detect errors in the stored data, which could have crept in while storing or transmitting the data.

Verify checksum in Ubuntu

In Ubuntu, there are numerous command-line utilities available to verify checksum. We would cover sha256sum command-line utility here. sha256sum command-line utility is mainly used to check and compute SHA256 message digest.

SHA256 basically outputs a value which is 256 bits long. It is a cryptographic hash function. Now, understand it with the help of an example. Let's say we have an ISO file - test.iso

To compute the SHA256 cryptographic hash or checksum -

sha256sum test.iso

It would return with the following -

e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 test.iso

The sha256sum is used to verify both integrity and authenticity of the data. We can store the above checksum of test.iso file and compare it with the new checksum at a later date to check for errors. If both the checksums match then, there are no issues detected. But, if there are issues then the file has changed and we need to get the file again from the source.

In conclusion, we have covered how to verify checksum in Ubuntu here using sha256sum command-line utility.