Checksum using cksum Linux

How can you verify that the content of the file that you had just downloaded from Internet or via using your email are exactly the same as they had been send to you?

Might be there is data injection on the way or you are unable to download the file properly because of some connectivity issues.

In any case always check the checksum of the file before using it or deploying it.

Checksum is used for verifying the integrity of the data.

Using the CRC checksum mechanism the data integrity can be verified.

What is CRC?

CRC stands for cyclic redundancy check.

Checksum can be calculated by applying cyclic redundancy check (CRC) mechanism over the data that is being communicated. Each block of data that is traveling the communication channel is attached with a CRC code or checksum and when the data block reaches the destination, this check is applied again to generate a checksum value. If the checksum generated at the destination and the checksum value in the data block are same then data is believed to be non-corrupted and can be used safely but if the two checksum values are not same then in that case data is said to be corrupted or infected.

Though we can use openssl (which you learn in your RHCE or RHCSS Training) for checking the checksum. There is one more very simple and beautiful command.

cksum

Just write –

cksum filname 

to check the checksum of the file

Even a small change in the contents of the file will change the value generated by cksum command.

Here is a illustrated output of cksum from my machine.

(now always remember to use it before using any file downloaded via Internet or email. You can always ask for cksum checksum from the source)

checksum using cksum command networknuts

checksum using cksum command networknuts

Advertisements