md5sum - Unix, Linux Command



NAME

md5sum - compute and check MD5 message digest.

SYNOPSIS

  • md5sum [OPTION]... [FILE]...
  • DESCRIPTION

    md5sum produces for each input file a 128-bit "finger-print" or "message-digest" or it can check with the output of a former run whether the message digests are still the same (i.e. whether the files changed).

    Options

    Tag Description
    -b, --binary Treat all input files as binary. This normally does not make any difference on UNIX systems but some systems have a different internal and external representation of texts (especially the end-of-line characters).
    -c, --check=file file should be the output of a former run of md5sum. The file has in each line the MD5 sum, a binary/text flag, and a file name. This file will be opened (with each possible relative path) and the message digest is computed. If it is not the same as given in this line it will be marked as failed.
    -t, --text read in text mode (default).
    --quiet don't print OK for each successfully verified file.
    --status don't output anything, status code shows success.
    -w, --warn warn about improperly formatted checksum lines.
    --help display this help and exit
    --version output version information and exit.

    EXAMPLES

    Example-1:

    To Calculate / Compute md5sum :

    $ md5sum file.txt

    output:

    3b85ec9ab2984b91070128be6aae25eb  file.txt
    

    Example-2:

    Calculate or compute md5sum for the input given through STDIN:

    $ md5sum -

    test

    output:

    d8e8fca2dc0f896fd7cb4cb0031ba249  -
    

    Example-3:

    Compute and Verify checksum of files :

    $ md5sum *.txt

    output:
    bbd166fee3f3f624286c4d85dc1994f8 abc.txt 50dcf8c353827eef464cb79f55018d6c xyz.txt $ md5sum *.txt > txtmd5sum.md5 $ md5sum -c txtmd5sum.md5 abc.txt: OK xyz.txt: OK If there is a change in any of the file, you will get the “computed checksums did NOT match” warning message. i.e: md5sum: WARNING: 1 of 3 computed checksums did NOT match

    Example-4:

    To read in binary mode(md5sum -b file_path):

    $ md5sum 1.txt

    output:

    764efa883dda1e11db47671c4a3bbd9e  1.txt
    
    $ md5sum -b 1.txt 
    764efa883dda1e11db47671c4a3bbd9e *1.txt
    
    $ md5sum --binary 1.txt 
    764efa883dda1e11db47671c4a3bbd9e *1.txt
    
    “-b” option is equivalent to “–binary” option.
    Print
    Advertisements