It seems to me that .md5 checksum files provided for verifying downloads mostly contain the checksum for the file to verify, but not the filename.
Using md5sum
that's seemingly a bit impractical, because when -checking it wants md5 key and filename separated by whitespace as input.
So, given these files that just contains the checksum, what is the most practical one-liner for checking them?
This post suggests a way, but warrants manual input of key and file name.
md5sum -c - <<< "b4460802b5853b7bb257fbf071ee4ae2 foo"
This post has this interesting suggestion, but I find it a bit hard to read and type:
cmp foo.md5 <(md5sum foo | awk '{print $1}') && echo $?
This works but is impractical because of the manual input of the filename (that doesn't autocomplete on my system):
printf $(cat foo.md5)\\tfoo | md5sum -c -
and this autocompletes but feels unwieldy:
printf "%s %s" $(cat foo.md5) foo | md5sum -c -
This is better because autocomplete works, but it's potentially a bit long, and also three steps.
md5sum foo | awk '{printf $1}' | diff foo.md5
Any further ideas?
md5sum /etc/passwd
d1924de8258210b319ec74c188e66d45 /etc/passwd
– Ipor Sircer Nov 10 '16 at 10:25