coreutils: md5sum invocation
1
1 6.5 ‘md5sum’: Print or check MD5 digests
1 ========================================
1
1 ‘md5sum’ computes a 128-bit checksum (or “fingerprint” or
1 “message-digest”) for each specified FILE.
1
1 Note: The MD5 digest is more reliable than a simple CRC (provided by
1 the ‘cksum’ command) for detecting accidental file corruption, as the
1 chances of accidentally having two files with identical MD5 are
1 vanishingly small. However, it should not be considered secure against
1 malicious tampering: although finding a file with a given MD5
1 fingerprint is considered infeasible at the moment, it is known how to
1 modify certain files, including digital certificates, so that they
1 appear valid when signed with an MD5 digest. For more secure hashes,
11 consider using SHA-2, or the newer ‘b2sum’ command. ⇒sha2
utilities. ⇒b2sum invocation.
1
1 If a FILE is specified as ‘-’ or if no files are given ‘md5sum’
1 computes the checksum for the standard input. ‘md5sum’ can also
1 determine whether a file and checksum are consistent. Synopsis:
1
1 md5sum [OPTION]... [FILE]...
1
1 For each FILE, ‘md5sum’ outputs by default, the MD5 checksum, a
1 space, a flag indicating binary or text input mode, and the file name.
1 Binary mode is indicated with ‘*’, text mode with ‘ ’ (space). Binary
1 mode is the default on systems where it’s significant, otherwise text
1 mode is the default. Without ‘--zero’, if FILE contains a backslash or
1 newline, the line is started with a backslash, and each problematic
1 character in the file name is escaped with a backslash, making the
1 output unambiguous even in the presence of arbitrary file names. If
1 FILE is omitted or specified as ‘-’, standard input is read.
1
11 The program accepts the following options. Also see ⇒Common
options.
1
1 ‘-b’
1 ‘--binary’
1 Treat each input file as binary, by reading it in binary mode and
1 outputting a ‘*’ flag. This is the inverse of ‘--text’. On
1 systems like GNU that do not distinguish between binary and text
1 files, this option merely flags each input mode as binary: the MD5
1 checksum is unaffected. This option is the default on systems like
1 MS-DOS that distinguish between binary and text files, except for
1 reading standard input when standard input is a terminal.
1
1 ‘-c’
1 ‘--check’
1 Read file names and checksum information (not data) from each FILE
1 (or from stdin if no FILE was specified) and report whether the
1 checksums match the contents of the named files. The input to this
1 mode of ‘md5sum’ is usually the output of a prior,
1 checksum-generating run of ‘md5sum’. Three input formats are
1 supported. Either the default output format described above, the
1 ‘--tag’ output format, or the BSD reversed mode format which is
1 similar to the default mode, but doesn’t use a character to
1 distinguish binary and text modes. Output with ‘--zero’ enabled is
1 not supported by ‘--check’.
1
1 For each such line, ‘md5sum’ reads the named file and computes its
1 MD5 checksum. Then, if the computed message digest does not match
1 the one on the line with the file name, the file is noted as having
1 failed the test. Otherwise, the file passes the test. By default,
1 for each valid line, one line is written to standard output
1 indicating whether the named file passed the test. After all
1 checks have been performed, if there were any failures, a warning
1 is issued to standard error. Use the ‘--status’ option to inhibit
1 that output. If any listed file cannot be opened or read, if any
1 valid line has an MD5 checksum inconsistent with the associated
1 file, or if no valid line is found, ‘md5sum’ exits with nonzero
1 status. Otherwise, it exits successfully.
1
1 ‘--ignore-missing’
1 This option is useful only when verifying checksums. When
1 verifying checksums, don’t fail or report any status for missing
1 files. This is useful when verifying a subset of downloaded files
1 given a larger list of checksums.
1
1 ‘--quiet’
1 This option is useful only when verifying checksums. When
1 verifying checksums, don’t generate an ’OK’ message per
1 successfully checked file. Files that fail the verification are
1 reported in the default one-line-per-file format. If there is any
1 checksum mismatch, print a warning summarizing the failures to
1 standard error.
1
1 ‘--status’
1 This option is useful only when verifying checksums. When
1 verifying checksums, don’t generate the default one-line-per-file
1 diagnostic and don’t output the warning summarizing any failures.
1 Failures to open or read a file still evoke individual diagnostics
1 to standard error. If all listed files are readable and are
1 consistent with the associated MD5 checksums, exit successfully.
1 Otherwise exit with a status code indicating there was a failure.
1
1 ‘--tag’
1 Output BSD style checksums, which indicate the checksum algorithm
1 used. As a GNU extension, if ‘--zero’ is not used, file names with
1 problematic characters are escaped as described above, with the
1 same escaping indicator of ‘\’ at the start of the line, being
1 used. The ‘--tag’ option implies binary mode, and is disallowed
1 with ‘--text’ mode as supporting that would unnecessarily
1 complicate the output format, while providing little benefit.
1
1 ‘-t’
1 ‘--text’
1 Treat each input file as text, by reading it in text mode and
1 outputting a ‘ ’ flag. This is the inverse of ‘--binary’. This
1 option is the default on systems like GNU that do not distinguish
1 between binary and text files. On other systems, it is the default
1 for reading standard input when standard input is a terminal. This
1 mode is never defaulted to if ‘--tag’ is used.
1
1 ‘-w’
1 ‘--warn’
1 When verifying checksums, warn about improperly formatted MD5
1 checksum lines. This option is useful only if all but a few lines
1 in the checked input are valid.
1
1 ‘--strict’
1 When verifying checksums, if one or more input line is invalid,
1 exit nonzero after all warnings have been issued.
1
1 ‘-z’
1 ‘--zero’
1 Output a zero byte (ASCII NUL) at the end of each line, rather than
1 a newline. This option enables other programs to parse the output
1 even when that output would contain data with embedded newlines.
1 Also file name escaping is not used.
1
1 An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1