<code>cksum</code> is a shell command for generating a checksum for a file or stream of data. The command reports the 32-bit cyclic redundancy check (CRC) checksum and byte count for each file specified in the command-line arguments or for standard input if no arguments provided.

The command can be used to verify that files transferred (possibly via unreliable means) arrived intact. However, the checksum calculated is not cryptographically secure. While it guards against accidental corruption (it is unlikely that the corrupted data will have the same checksum as the intended data), it is not difficult for an attacker to deliberately corrupt the file in a specific way that its checksum is unchanged. Unix-like systems typically include other commands for cryptographically secure checksums, such as sha256sum.

The command is available on Unix and Unix-like system and via UnxUtils. The GNU Coreutils implementation provides additional checksum algorithms via option, as an extension beyond POSIX. macOS, and Solaris) uses a CRC algorithm based on the ethernet standard frame check

Examples

The following calculates the checksum for file <code>test.txt</code>. The checksum is 4038471504 and the file size is 75 bytes.

<syntaxhighlight lang="console">

$ cksum test.txt

4038471504 75 test.txt

</syntaxhighlight>

See also

References

  • cksum – GNU Core Utilities