sha256sum

Used to calculate the SHA-256 hash of a file

Supplementary instructions

sha256sum command is to print or check SHA256 (256-bit) checksum

grammar

sha256sum [OPTION]... [FILE]...

Options

-b, --binary # Read in binary mode
-c, --check # Read SHA256 checksum from file and check
     --tag # Create BSD-style checksums
-t, --text # Read in text mode (default)
-z, --zero # Terminate each line of output with NUL instead of newline and disable filename escaping
     --help # Show this help and exit
     --version # Output version information and exit

Example

Here are some examples using the sha256sum command:

sha256sum file.txt

This will output the SHA-256 hash and file name of the file file.txt.

sha256sum file1.txt file2.txt

This will output the SHA-256 hashes and file names of the files file1.txt and file2.txt.

sha256sum file.txt > hash.txt

This will save the SHA-256 hash of the file file.txt into the file hash.txt.

sha256sum -c hash.txt

This will verify that the SHA-256 hash of the file matches the value in hash.txt. If there is a match, output OK, otherwise output FAILED.