Home·Terminal commands

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

FlagMeaning
-cRead a list of hashes and check each file against it
-bBinary mode, which matters on Windows-style line endings
--tagGNU: print in the BSD format, SHA256 (file) = hash
--ignore-missingGNU: with -c, skip files that are not there
shasum -a 256The same digest where sha256sum is missing, as on older macOS

Examples

sha256sum ubuntu.iso

Prints the hash to compare with the download page.

sha256sum -c SHA256SUMS

Verifies every file named in the checksum list.

shasum -a 256 ubuntu.iso

The 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