Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am confused how md5sum --check is supposed to work:

$ man md5sum
-c, --check
    read MD5 sums from the FILEs and check them

I have a file, I can pipe it to md5sum:

$ cat file | md5sum
44693b9ef883e231cd9f90f737acd58f  -

When I want to check the integrity of the file tomorrow, how can I check if the md5sum is still 44693b9ef883e231cd9f90f737acd58f?


cat file might be a stream. So I want to use the pipe as in my example, not md5sum file.

share|improve this question
up vote 19 down vote accepted

You do this:

cat file | md5sum > sumfile

And the next day you can do this:

cat file | md5sum --check sumfile

Which prints:

-: OK

if everything is alright.

share|improve this answer

The default syntax for md5sum is:

$ md5sum file 
068a9a19124df814e52ff5461598cfe4  file

To create a checksum file, redirect standard output to a file:

$ md5sum file > md5.checksum

To verify the file against the checksum file:

$ cd path/to/file
$ md5sum --check path/to/md5.checksum
file: OK

That said, m13r's implementations is equally valid.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.