The Linux cksum command is used to display the CRC checksum value and byte statistics of a file.
Linux cksum command Function Description
Use the cksum command to display the CRC checksum values and byte statistics for each file.
The cksum command is used to check if the CRC of a file is correct and to ensure that the file is not corrupted during the transfer from one system to another. This method requires that the checksum is calculated in the source system and again in the destination system, the two numbers are compared, and if the checksum is equal, the file is considered to have been transferred correctly.
CRC refers to a method of error checking, known as Cyclic Redundancy Checking.
When a file is specified for checksum, the checksum result will be returned for the user to check if the file is correct. If no file name is specified or the given file name is -
, the cksum command will read the data from the standard input device.
Linux cksum command Syntax
cksum [file]
Linux cksum command Examples
Display CRC checksums and byte statistics for the /home/deepinout/apidemos.com/ccc.txt file
cksum /home/deepinout/apidemos.com/ccc.txt
Output:
To calculate the integrity of the file "testfile1" using the cksum command, enter the following command:
cksum testfile1 #CRC checksum for specified files
After the above command is executed, the information related to the check code will be output, and the specific output information is shown as follows:
1263453430 78 testfile1 #Output Information
In the above output message, "1263453430" is the check digit and "78" is the number of bytes.
If any character in the file is modified, it will change the value of the calculated CRC checksum.