Forrest logo
back to the sha256sum tool

sha256sum:tldr:401d6

sha256sum: Only show a message for missing files or when verification fails.
$ sha256sum --check --quiet ${filename-sha256}
try on your machine

The command sha256sum --check --quiet ${filename-sha256} is used to perform a quick check on the integrity of one or more files using the SHA-256 hash algorithm.

Here's a breakdown of each component of the command:

  • sha256sum: This is the command used to calculate the SHA-256 hash values of files. It generates a unique 256-bit hash value for each file passed to it.

  • --check: This flag tells the sha256sum command to read a list of SHA-256 hashes and filenames from a file (or from standard input) and check if the calculated hash of each file matches the provided hash.

  • --quiet: This flag tells the sha256sum command to not display any output for files whose hash matches the provided hash. It only displays output for files that do not match the hash.

  • ${filename-sha256}: This is a parameter expansion or substitution that is used to specify the file containing the list of SHA-256 hashes and filenames. The actual name of the file is represented by filename here. The -sha256 part suggests that the file is named with the .sha256 extension.

So, when you execute this command, it reads a file (specified by ${filename-sha256}) which contains a list of filenames and corresponding SHA-256 hashes. It then calculates the SHA-256 hash of each file in the list and compares it with the provided hash. If the hashes match, it remains silent (due to --quiet) and doesn't display any output. If the hashes don't match, it displays an error message indicating that the file has been modified or corrupted.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the sha256sum tool