Generate a SHA-256 digest from image.iso.
Print the digest and filename in the standard checksum format.
Which command is correct?
sha256sum calculates a SHA-256 digest from file contents. It can be used to compare identical data or verify a downloaded file.
Detailed explanation
md5sum image.isoIncorrect. md5sum calculates MD5, not SHA-256.
Incorrect. md5sum calculates MD5, not SHA-256.
sha256sum image.isoCorrect. sha256sum prints the SHA-256 digest and the filename.
Correct. sha256sum prints the SHA-256 digest and the filename.
sha512sum image.isoIncorrect. sha512sum uses the SHA-512 algorithm.
Incorrect. sha512sum uses the SHA-512 algorithm.
wc -c image.isoIncorrect. wc -c counts bytes and does not calculate a digest.
Incorrect. wc -c counts bytes and does not calculate a digest.
Try it yourself
An example you can run in a temporary verification environment.
printf abc | sha256sumExpected result
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad -Key points
- The command name selects the hash algorithm
- Identical input produces the same digest
- sha256sum -c verifies a checksum list
Notes
- Environment: GNU coreutils 9.x
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.