manpagez: man pages & more
info coreutils
Home | html | info | man

File: coreutils.info,  Node: cksum invocation,  Next: b2sum invocation,  Prev: sum invocation,  Up: Summarizing files

6.3 ‘cksum’: Print and verify file checksums
============================================

‘cksum’ by default computes a cyclic redundancy check (CRC) checksum for
each given FILE, or standard input if none are given or for a FILE of
‘-’.

   cksum also supports the ‘-a/--algorithm’ option to select the digest
algorithm to use.  ‘cksum’ is the preferred interface to these digests,
subsuming the other standalone checksumming utilities, which can be
emulated using ‘cksum -a md5 --untagged "$@"’ etc.  Synopsis:

     cksum [OPTION]... [FILE]...

   ‘cksum’ is typically used to ensure that files have not been
corrupted, by comparing the ‘cksum’ output for the received files with
the ‘cksum’ output for the original files (typically given in the
distribution).

   ‘cksum’ by default prints the POSIX standard CRC checksum for each
file along with the number of bytes in the file, and the file name
unless no arguments were given.

   The same usage and options as the ‘b2sum’ command are supported.
*Note b2sum invocation::.  In addition ‘cksum’ supports the following
options.

‘-a’
‘--algorithm’
     Compute checksums using the specified digest algorithm.

     Supported legacy checksums (which are not supported by ‘--check’):
          ‘sysv’      equivalent to sum -s
          ‘bsd’       equivalent to sum -r
          ‘crc’       equivalent to cksum (the default)

     Supported more modern digest algorithms are:
          ‘md5’       equivalent to md5sum
          ‘sha1’      equivalent to sha1sum
          ‘sha224’    equivalent to sha224sum
          ‘sha256’    equivalent to sha256sum
          ‘sha384’    equivalent to sha384sum
          ‘sha512’    equivalent to sha512sum
          ‘blake2b’   equivalent to b2sum
          ‘sm3’       only available through cksum

‘-b’
‘--base64’
     Print base64-encoded digests not hexadecimal.  This option is
     ignored with ‘--check’.  The format conforms to RFC 4648#4
     (https://tools.ietf.org/search/rfc4648#section-4).

     Note that each base64-encoded digest has zero, one or two trailing
     padding (‘=’) bytes.  The length of that padding is the
     checksum-bit-length modulo 3, and the ‘--check’ parser requires
     precisely the same input digest string as what is output.  I.e.,
     removing or adding any ‘=’ padding renders a digest non-matching.

‘--debug’
     Output extra information to stderr, like the checksum
     implementation being used.

‘--raw’
     Print only the unencoded raw binary digest for a single input.  Do
     not output the file name or anything else.  Use network byte order
     (big endian) where applicable: for ‘bsd’, ‘crc’, and ‘sysv’.  This
     option works only with a single input.  Unlike other output
     formats, ‘cksum’ provides no way to ‘--check’ a ‘--raw’ checksum.

‘--untagged’
     Output using the original Coreutils format used by the other
     standalone checksum utilities like ‘md5sum’ for example.  This
     format has the checksum at the start of the line, and may be more
     amenable to further processing by other utilities, especially in
     combination with the ‘--zero’ option.  Note this does not identify
     the digest algorithm used for the checksum.  *Note md5sum
     invocation:: for details of this format.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.