File: coreutils.info, Node: cksum invocation, Next: md5sum invocation, Prev: sum invocation, Up: Summarizing files 6.3 'cksum': Print and verify file checksums 'cksum' by default computes a 32-bit 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). * Menu: * cksum output modes:: Legacy and non Legacy output formats * cksum general options:: Options supported only by cksum * cksum common options:: Options supported also by standalone utilities File: coreutils.info, Node: cksum output modes, Next: cksum general options, Up: cksum invocation Legacy output format '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 32-bit CRC used is based on the polynomial used for CRC error checking in the ISO/IEC 8802-3:1996 standard (Ethernet). Similar output formats are used for the other legacy checksums selectable with '--algorithm=sysv' or '--algorithm=bsd', detailed at *note sum invocation::. Tagged output format With the '--algorithm' option selecting non legacy checksums, the 'cksum' command defaults to output of the form: DIGEST_NAME (FILE NAME) = DIGEST Note the standalone checksum utilities can select this output mode by using the '--tag' option. Untagged output format With the '--untagged' option and the '--algorithm' option selecting non legacy checksums, the following output format is used. Note this is the default output format of the standalone checksum utilities. For each FILE, we print the checksum, a space, a flag indicating binary or text input mode, and the file name. Binary mode is indicated with '*', text mode with ' ' (space). Binary mode is the default on systems where it's significant, otherwise text mode is the default. Note without '--zero', and with non legacy output formats, if FILE contains a backslash, newline, or carriage return, the line is started with a backslash, and each problematic character in the file name is escaped with a backslash, making the output unambiguous even in the presence of arbitrary file names. Since the backslash character itself is escaped, any other backslash escape sequences are reserved for future use. File: coreutils.info, Node: cksum general options, Next: cksum common options, Prev: cksum output modes, Up: cksum invocation '-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 '--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. '-l' '--length' Change (shorten) the default digest length. This is specified in bits and thus must be a multiple of 8. This option is ignored when '--check' is specified, as the length is automatically determined when checking. '--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 cksum output modes:: for details of this format. File: coreutils.info, Node: cksum common options, Prev: cksum general options, Up: cksum invocation '-b' '--binary' Note this option is not supported by the 'cksum' command, as it operates in binary mode exclusively. Treat each input file as binary, by reading it in binary mode and outputting a '*' flag. This is the inverse of '--text'. On systems like GNU that do not distinguish between binary and text files, this option merely flags each input mode as binary: the checksum is unaffected. This option is the default on systems like MS-DOS that distinguish between binary and text files, except for reading standard input when standard input is a terminal. '-c' '--check' Read file names and checksum information (not data) from each FILE (or from standard input if no FILE was specified) and report whether the checksums match the contents of the named files. The input to this mode is usually the output of a prior, checksum-generating run of the command. Three input formats are supported. Either the default output format described above, the '--tag' output format, or the BSD reversed mode format which is similar to the default mode, but doesn't use a character to distinguish binary and text modes. For the 'cksum' command, the '--check' option supports auto-detecting the digest algorithm to use, when presented with checksum information in the '--tag' output format. Also for the 'cksum' command, the '--check' option auto-detects the digest encoding, accepting both standard hexadecimal checksums and those generated via 'cksum' with its '--base64' option. Output with '--zero' enabled is not supported by '--check'. For each such line, 'cksum' reads the named file and computes its checksum. Then, if the computed message digest does not match the one on the line with the file name, the file is noted as having failed the test. Otherwise, the file passes the test. By default, for each valid line, one line is written to standard output indicating whether the named file passed the test. After all checks have been performed, if there were any failures, a warning is issued to standard error. Use the '--status' option to inhibit that output. If any listed file cannot be opened or read, if any valid line has a checksum inconsistent with the associated file, or if no valid line is found, 'cksum' exits with nonzero status. Otherwise, it exits successfully. Note the 'cksum' command doesn't support '--check' with the older 'sysv', 'bsd', or 'crc' algorithms. '--ignore-missing' This option is useful only when verifying checksums. When verifying checksums, don't fail or report any status for missing files. This is useful when verifying a subset of downloaded files given a larger list of checksums. '--quiet' This option is useful only when verifying checksums. When verifying checksums, don't generate an 'OK' message per successfully checked file. Files that fail the verification are reported in the default one-line-per-file format. If there is any checksum mismatch, print a warning summarizing the failures to standard error. '--status' This option is useful only when verifying checksums. When verifying checksums, don't generate the default one-line-per-file diagnostic and don't output the warning summarizing any failures. Failures to open or read a file still evoke individual diagnostics to standard error. If all listed files are readable and are consistent with the associated checksums, exit successfully. Otherwise exit with a status code indicating there was a failure. '--tag' Output BSD style checksums, which indicate the checksum algorithm used. As a GNU extension, if '--zero' is not used, file names with problematic characters are escaped as described above, using the same escaping indicator of '\' at the start of the line, as used with the other output format. The '--tag' option implies binary mode, and is disallowed with '--text' mode as supporting that would unnecessarily complicate the output format, while providing little benefit. *Note cksum output modes:: for details of this format. The 'cksum' command, uses '--tag' as its default output format. '-t' '--text' Note this option is not supported by the 'cksum' command. Treat each input file as text, by reading it in text mode and outputting a ' ' flag. This is the inverse of '--binary'. This option is the default on systems like GNU that do not distinguish between binary and text files. On other systems, it is the default for reading standard input when standard input is a terminal. This mode is never defaulted to if '--tag' is used. '-w' '--warn' When verifying checksums, warn about improperly formatted checksum lines. This option is useful only if all but a few lines in the checked input are valid. '--strict' When verifying checksums, if one or more input line is invalid, exit nonzero after all warnings have been issued. '-z' '--zero' Output a zero byte (ASCII NUL) at the end of each line, rather than a newline. This option enables other programs to parse the output even when that output would contain data with embedded newlines. Also file name escaping is not used.
Generated by phpman v4.12.26 · Markdown · JSON Author: Che Dong Under GNU General Public License
2026-11-15 06:57 @216.73.216.149
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)