cksum

Display file checksums and block counts (POSIX)

Syntax:

cksum [-o algorithm] [-q|-v] [file...]

Runs on:

QNX Neutrino, Linux, Microsoft Windows

Options:

-o algorithm
Use the specified algorithm. Valid algorithm values include:
Algorithm Action
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)
-q
Quiet. Don't display header (counteracts -v). (Default)
-v
Verbose. Display a header which states the algorithm used and names the output columns.
file
The pathname of a file to be checked. If no files are specified, the standard input is used.

Description:

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 Kilobytes %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.

Exit status:

0
All files were processed successfully.
>0
An error occurred.

See also:

cmp, diff