

The test file ‘testfile.txt’ has following contents: $ cat testfile.txt The first value (big number) in the output above is the checksum for the file, then we have the size of the file and finally the name of the file. On a very basic level, the cksum command can be used to display the checksum for a file. One can get a detailed information on this command by typing the following on the command prompt : $ info coreutils 'cksum invocation' cksum command examples 1. The command exits with status zero in case of success and any other status value indicates failure. Using the cksum command, one can compare the checksum of destination file with that of the source file to conclude that whether the data transfer was successful or not.īesides providing the CRC value, this command also produces the file size and file name in the output. CRC becomes important in situations where data integrity needs to be verified. The cksum command is used for computing the cyclic redundancy check (CRC) for each file provided to it as argument.
#Checksum command code
#Checksum command how to
For example in one of our articles ( IP header check sum) we discussed how to find the checksum of an IP header. There are various mechanisms through which a CRC checksum can be calculated.

Now, how would you verify the integrity of data? Well, its through the CRC checksum mechanism the data integrity can be verified. Suppose some file is being copied over a network or over a system and due to some event like network connection loss or sudden reboot of machine the data did not get copied completely. Checksum is used for verifying the integrity of the data.
