{
    "mode": "info",
    "parameter": "cksum",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/cksum/json",
    "generated": "2026-11-10T10:58:57Z",
    "sections": {
        "File: coreutils.info,  Node: cksum invocation,  Next: md5sum invocation,  Prev: sum invocation,  Up: Summarizing files": {
            "content": "",
            "subsections": [
                {
                    "name": "6.3 'cksum': Print and verify file checksums",
                    "content": "'cksum' by default computes a 32-bit cyclic redundancy check (CRC)\nchecksum for each given FILE, or standard input if none are given or for\na FILE of '-'.\n\ncksum also supports the '-a/--algorithm' option to select the digest\nalgorithm to use.  'cksum' is the preferred interface to these digests,\nsubsuming the other standalone checksumming utilities, which can be\nemulated using 'cksum -a md5 --untagged \"$@\"' etc.  Synopsis:\n\ncksum [OPTION]... [FILE]...\n\n'cksum' is typically used to ensure that files have not been\ncorrupted, by comparing the 'cksum' output for the received files with\nthe 'cksum' output for the original files (typically given in the\ndistribution).\n\n* Menu:\n\n* cksum output modes::          Legacy and non Legacy output formats\n* cksum general options::       Options supported only by cksum\n* cksum common options::        Options supported also by standalone utilities\n"
                }
            ]
        },
        "File: coreutils.info,  Node: cksum output modes,  Next: cksum general options,  Up: cksum invocation": {
            "content": "",
            "subsections": []
        },
        "Legacy output format": {
            "content": "'cksum' by default prints the POSIX standard CRC checksum for each\nfile along with the number of bytes in the file, and the file name\nunless no arguments were given.  The 32-bit CRC used is based on\nthe polynomial used for CRC error checking in the ISO/IEC\n8802-3:1996 standard (Ethernet).  Similar output formats are used\nfor the other legacy checksums selectable with '--algorithm=sysv'\nor '--algorithm=bsd', detailed at *note sum invocation::.\n",
            "subsections": []
        },
        "Tagged output format": {
            "content": "With the '--algorithm' option selecting non legacy checksums, the\n'cksum' command defaults to output of the form:\nDIGESTNAME (FILE NAME) = DIGEST\nNote the standalone checksum utilities can select this output mode\nby using the '--tag' option.\n",
            "subsections": []
        },
        "Untagged output format": {
            "content": "With the '--untagged' option and the '--algorithm' option selecting\nnon legacy checksums, the following output format is used.  Note\nthis is the default output format of the standalone checksum\nutilities.  For each FILE, we print the checksum, a space, a flag\nindicating binary or text input mode, and the file name.  Binary\nmode is indicated with '*', text mode with ' ' (space).  Binary\nmode is the default on systems where it's significant, otherwise\ntext mode is the default.\n\nNote without '--zero', and with non legacy output formats, if FILE\ncontains a backslash, newline, or carriage return, the line is started\nwith a backslash, and each problematic character in the file name is\nescaped with a backslash, making the output unambiguous even in the\npresence of arbitrary file names.  Since the backslash character itself\nis escaped, any other backslash escape sequences are reserved for future\nuse.\n",
            "subsections": []
        },
        "File: coreutils.info,  Node: cksum general options,  Next: cksum common options,  Prev: cksum output modes,  Up: cksum invocation": {
            "content": "'-a'\n'--algorithm'\nCompute checksums using the specified digest algorithm.\n\nSupported legacy checksums (which are not supported by '--check'):\n'sysv'      equivalent to sum -s\n'bsd'       equivalent to sum -r\n'crc'       equivalent to cksum (the default)\n\nSupported more modern digest algorithms are:\n'md5'       equivalent to md5sum\n'sha1'      equivalent to sha1sum\n'sha224'    equivalent to sha224sum\n'sha256'    equivalent to sha256sum\n'sha384'    equivalent to sha384sum\n'sha512'    equivalent to sha512sum\n'blake2b'   equivalent to b2sum\n'sm3'       only available through cksum\n\n'--base64'\nPrint base64-encoded digests not hexadecimal.  This option is\nignored with '--check'.  The format conforms to RFC 4648#4\n(https://tools.ietf.org/search/rfc4648#section-4).\n\nNote that each base64-encoded digest has zero, one or two trailing\npadding ('=') bytes.  The length of that padding is the\nchecksum-bit-length modulo 3, and the '--check' parser requires\nprecisely the same input digest string as what is output.  I.e.,\nremoving or adding any '=' padding renders a digest non-matching.\n\n'--debug'\nOutput extra information to stderr, like the checksum\nimplementation being used.\n\n'-l'\n'--length'\nChange (shorten) the default digest length.  This is specified in\nbits and thus must be a multiple of 8.  This option is ignored when\n'--check' is specified, as the length is automatically determined\nwhen checking.\n\n'--raw'\nPrint only the unencoded raw binary digest for a single input.  Do\nnot output the file name or anything else.  Use network byte order\n(big endian) where applicable: for 'bsd', 'crc', and 'sysv'.  This\noption works only with a single input.  Unlike other output\nformats, 'cksum' provides no way to '--check' a '--raw' checksum.\n\n'--untagged'\nOutput using the original Coreutils format used by the other\nstandalone checksum utilities like 'md5sum' for example.  This\nformat has the checksum at the start of the line, and may be more\namenable to further processing by other utilities, especially in\ncombination with the '--zero' option.  Note this does not identify\nthe digest algorithm used for the checksum.  *Note cksum output\nmodes:: for details of this format.\n",
            "subsections": []
        },
        "File: coreutils.info,  Node: cksum common options,  Prev: cksum general options,  Up: cksum invocation": {
            "content": "'-b'\n'--binary'\nNote this option is not supported by the 'cksum' command, as it\noperates in binary mode exclusively.  Treat each input file as\nbinary, by reading it in binary mode and outputting a '*' flag.\nThis is the inverse of '--text'.  On systems like GNU that do not\ndistinguish between binary and text files, this option merely flags\neach input mode as binary: the checksum is unaffected.  This option\nis the default on systems like MS-DOS that distinguish between\nbinary and text files, except for reading standard input when\nstandard input is a terminal.\n\n'-c'\n'--check'\nRead file names and checksum information (not data) from each FILE\n(or from standard input if no FILE was specified) and report\nwhether the checksums match the contents of the named files.  The\ninput to this mode is usually the output of a prior,\nchecksum-generating run of the command.\n\nThree input formats are supported.  Either the default output\nformat described above, the '--tag' output format, or the BSD\nreversed mode format which is similar to the default mode, but\ndoesn't use a character to distinguish binary and text modes.\n\nFor the 'cksum' command, the '--check' option supports\nauto-detecting the digest algorithm to use, when presented with\nchecksum information in the '--tag' output format.\n\nAlso for the 'cksum' command, the '--check' option auto-detects the\ndigest encoding, accepting both standard hexadecimal checksums and\nthose generated via 'cksum' with its '--base64' option.\n\nOutput with '--zero' enabled is not supported by '--check'.\n\nFor each such line, 'cksum' reads the named file and computes its\nchecksum.  Then, if the computed message digest does not match the\none on the line with the file name, the file is noted as having\nfailed the test.  Otherwise, the file passes the test.  By default,\nfor each valid line, one line is written to standard output\nindicating whether the named file passed the test.  After all\nchecks have been performed, if there were any failures, a warning\nis issued to standard error.  Use the '--status' option to inhibit\nthat output.  If any listed file cannot be opened or read, if any\nvalid line has a checksum inconsistent with the associated file, or\nif no valid line is found, 'cksum' exits with nonzero status.\nOtherwise, it exits successfully.  Note the 'cksum' command doesn't\nsupport '--check' with the older 'sysv', 'bsd', or 'crc'\nalgorithms.\n\n'--ignore-missing'\nThis option is useful only when verifying checksums.  When\nverifying checksums, don't fail or report any status for missing\nfiles.  This is useful when verifying a subset of downloaded files\ngiven a larger list of checksums.\n\n'--quiet'\nThis option is useful only when verifying checksums.  When\nverifying checksums, don't generate an 'OK' message per\nsuccessfully checked file.  Files that fail the verification are\nreported in the default one-line-per-file format.  If there is any\nchecksum mismatch, print a warning summarizing the failures to\nstandard error.\n\n'--status'\nThis option is useful only when verifying checksums.  When\nverifying checksums, don't generate the default one-line-per-file\ndiagnostic and don't output the warning summarizing any failures.\nFailures to open or read a file still evoke individual diagnostics\nto standard error.  If all listed files are readable and are\nconsistent with the associated checksums, exit successfully.\nOtherwise exit with a status code indicating there was a failure.\n\n'--tag'\nOutput BSD style checksums, which indicate the checksum algorithm\nused.  As a GNU extension, if '--zero' is not used, file names with\nproblematic characters are escaped as described above, using the\nsame escaping indicator of '\\' at the start of the line, as used\nwith the other output format.  The '--tag' option implies binary\nmode, and is disallowed with '--text' mode as supporting that would\nunnecessarily complicate the output format, while providing little\nbenefit.  *Note cksum output modes:: for details of this format.\nThe 'cksum' command, uses '--tag' as its default output format.\n\n'-t'\n'--text'\nNote this option is not supported by the 'cksum' command.  Treat\neach input file as text, by reading it in text mode and outputting\na ' ' flag.  This is the inverse of '--binary'.  This option is the\ndefault on systems like GNU that do not distinguish between binary\nand text files.  On other systems, it is the default for reading\nstandard input when standard input is a terminal.  This mode is\nnever defaulted to if '--tag' is used.\n\n'-w'\n'--warn'\nWhen verifying checksums, warn about improperly formatted checksum\nlines.  This option is useful only if all but a few lines in the\nchecked input are valid.\n\n'--strict'\nWhen verifying checksums, if one or more input line is invalid,\nexit nonzero after all warnings have been issued.\n\n'-z'\n'--zero'\nOutput a zero byte (ASCII NUL) at the end of each line, rather than\na newline.  This option enables other programs to parse the output\neven when that output would contain data with embedded newlines.\nAlso file name escaping is not used.\n",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}