Check md5sum from pipe

hashsumpipe

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?

Note

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

Best Answer

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.

Related Question