I'm trying to better understand the use of "SHA256SUMS" and "grep." The Ubuntu verify and authenticate tutorial uses the following term: "sha256sum -c SHA256SUMS 2>&1 | grep OK" to verify the download hasn't been corrupted.
I understand it's checking at the SHA256SUMS file that contains two hash values, one for the Desktop version and one for the Live. The usage worked, and I checked it by manually verifying the hash values.
My question is what is the "SHA256SUMS 2>&1" portion doing? Also, it appears to be a part of the "SHA256SUMS" command, though I don't see that usage on the man page I use. Then somehow the result is piped to "grep" to pattern-match with no options.
I'd like to understand it well enough to use the technique in verifying that other software downloads haven't been corrupted.
sha256sum -c SHA256SUMS
;2>&1
is a shell redirection that combines the command's standard error stream2
with its standard output stream1
so that both are piped to thegrep
command