Display file checksums and block counts (POSIX)
cksum [[-9|-12] | -o algorithm] [-q | -v] [file...]
Algorithm: | Action: |
---|---|
1 | Use historic 16-bit checksum algorithm. |
2 | Use historic 32-bit checksum algorithm. |
9 | Use 1003.2 draft 9 algorithm (QNX 4.0) |
11 | Use 1003.2 draft 11 algorithm |
12 | Use 1003.2 draft 12 algorithm |
92 | Use 1003.2-1992 standard algorithm (Default) |
4.1 | Use old QNX cksum algorithm (QNX 4.10-4.21) |
All the options to cksum are QNX extensions to the POSIX 1003.2 cksum. |
The cksum utility writes one line to standard output for each file you specify. This line will contain the checksum of the file, as well as the file size and the name of the file being checked. The format of this output varies slightly depending on the command-line options specified to cksum as follows:
-o algorithm: | Filesize units: | Output format: |
---|---|---|
1 | k bytes | %lu %lu %s |
2 | 512-byte blocks | %lu %lu %s |
all others | bytes | %10lu %10lu %s |
If you don't specify any files, cksum processes standard input; no filename is given in the output line.
The cksum utility lets you quickly compare a suspect version of a file to a trusted version of the same file. You can also use cksum to check files after they have been transferred by modem, restored from backup media, or unpacked from a compressed form. The utilities that perform these operations have their own checks, but cksum serves as a useful independent checking mechanism.
If you wish to perform a byte-by-byte comparison of files, you can use the cmp utility.
Report the checksum of the file archive.tar.F:
cksum archive.tar.F
The data to be used for the checksum calculations are read from standard input if no file is specified on the command line. If files are specified, cksum will open and read from those files and the standard input will not be used.
The results of the calculations are written to standard output in the format detailed above in the cksum description.
Errors encountered during execution will result in diagnostic messages being written to standard error.