sha256sum
Files and directories
Usage
sha256sum [file]Prints a file's SHA-256 fingerprint so you can tell whether a download arrived intact; a matching hash proves the bytes match, not that the source is trustworthy.
Common flags
| Flag | Meaning |
|---|---|
| -c | Read a list of hashes and check each file against it |
| -b | Binary mode, which matters on Windows-style line endings |
| --tag | GNU: print in the BSD format, SHA256 (file) = hash |
| --ignore-missing | GNU: with -c, skip files that are not there |
| shasum -a 256 | The same digest where sha256sum is missing, as on older macOS |
Examples
sha256sum ubuntu.isoPrints the hash to compare with the download page.
sha256sum -c SHA256SUMSVerifies every file named in the checksum list.
shasum -a 256 ubuntu.isoThe portable macOS spelling.
Moving, deleting and finding. Some of these do not ask twice, which is why -i becomes a habit.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does sha256sum do?
Prints a file's SHA-256 fingerprint so you can tell whether a download arrived intact; a matching hash proves the bytes match, not that the source is trustworthy.
Q. How do I type it?
sha256sum [file] — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
5 are listed here; the full set is in man sha256sum. This command sits under Files and directories.
Related commands
man page: man sha256sum