Display file checksums and block counts (POSIX)
cksum [-o algorithm] [-q|-v] [file...]
|1||Use historic 16-bit checksum algorithm.|
|2||Use historic 32-bit checksum algorithm.|
|9||Use 1003.2 draft 9 algorithm (QNX versions 4.0 and 6)|
|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)|
The cksum utility writes one line to standard output for each file you specify. This line contains 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.