md5sum -c command

2 risposte [Ultimo contenuto]
Newbie
Offline
Iscritto: 01/09/2015

Hi there.

I've been looking for a way to verify md5sum of a trisquel iso file without having to compare md5sums by "hand".

So basically I wanted to avoid taking the result of "md5sum trisquel_7.0_amd64.iso" and comparing it with md5sum file by eye or by a text editor.

I found that I could use md5sum -c NameOfTheMD5SUMFile and it would either give me errors or OK message.

I downloaded a trisquel iso file and a trisquel md5sum file to the same directory then I run the command "md5sum -c trisquel_7.0_amd64.iso.md5" and the outcome was "trisquel_7.0_amd64.iso: OK".

Can anyone explain to me how exactly it works? I would like to know whether this generates md5sums of all files that are in the directory and then compares it to "trisquel_7.0_amd64.iso.md5" OR it generates md5sum of the file which name matches the name of md5sum file only.

I hope my question makes sense :)

Thanks in advance.

Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

As 'info md5sum' tells:

`-c'
`--check'
Read file names and checksum information (not data) from each FILE
(or from stdin if no FILE was specified) and report whether the
checksums match the contents of the named files. The input to
this mode of `md5sum' is usually the output of a prior,
checksum-generating run of `md5sum'. Each valid line of input
consists of an MD5 checksum, a binary/text flag, and then a file
name. Binary mode is indicated with `*', text with ` ' (space).
For each such line, `md5sum' reads the named file and computes its
MD5 checksum. Then, if the computed message digest does not match
the one on the line with the file name, the file is noted as having
failed the test. Otherwise, the file passes the test. By
default, for each valid line, one line is written to standard
output indicating whether the named file passed the test. After
all checks have been performed, if there were any failures, a
warning is issued to standard error. Use the `--status' option to
inhibit that output. If any listed file cannot be opened or read,
if any valid line has an MD5 checksum inconsistent with the
associated file, or if no valid line is found, `md5sum' exits with
nonzero status. Otherwise, it exits successfully.

Newbie
Offline
Iscritto: 01/09/2015

Thank you.