Session and utilities

The sha512sum command

Computes the SHA-512 digest of files, or checks a list of digests saved earlier.

Syntax

sha512sum [opciones] [archivo...]Try it in the terminal →

Most useful options

-c, --checkReads a list of digests and checks each file it names
-b, --binaryBinary mode. On GNU/Linux it gives the same result as text mode
-z, --zeroEnds each line with a NUL byte and does not escape names
--tagWrites the line in BSD style: SHA512 (file) = digest
--ignore-missingWith -c, skips listed files that do not exist
--quietWith -c, does not print OK for each correct file
--statusWith -c, prints nothing and only returns the exit status
-w, --warnWith -c, warns about lines in the list with an invalid format

Copy-ready examples

$ sha512sum /etc/passwddigest of a system file.
$ sha512sum informe.pdf > informe.pdf.sha512saves the digest in a file to check it later.
$ sha512sum -c informe.pdf.sha512verifies the file. If it matches, it prints OK.

Example output

informe.pdf: OK
$ sha512sum -c --ignore-missing SHA512SUMSverifies a download list and skips the files you do not have yet.

You can try them in the browser terminal: it does not touch your computer.

Common errors

MessageCauseFix
sha512sum: noexiste: No such file or directoryThe file does not exist or the name is misspelled.List the folder with ls and copy the exact name.
a.txt: FAILEDThe content no longer matches the digest in the list: it changed, or the list belongs to another version.Download the file again from its source and compare again.
sha512sum: lista.txt: no properly formatted SHA512 checksum lines foundThe file passed to -c has no digest lines. It usually happens when you name the original instead of the list. Depending on the version, the message may omit SHA512.Pass the file where you saved the digests, not the data file.

Typical mistakes

  • The digest is 128 hexadecimal characters. Copy all of it: one missing character no longer matches.
  • A digest only proves the file is identical to the original. If the list comes from the same place as the file, it does not protect against substitution.
  • With -c, names are looked up as written: if the list was made from another folder, the paths do not match.
  • With -c, an altered file shows as FAILED and the program exits with status 1.

Differences from similar commands

  • sha256sum: same SHA-2 family, with a 256-bit digest. Enough for most cases.
  • md5sum: old 128-bit digest. Do not use it to detect tampering.
  • sha1sum: 160-bit digest, also obsolete for security.

Security

A digest is only reliable if the list arrives through a different channel from the file. If an attacker changes both at once, the check will still report OK.

Related commands

FAQ

Why does the whole digest change if I edit one letter?

Hash functions make any change to the input produce a different, unpredictable digest. That is why they detect tampering.

Can I compute several digests at once?

Yes: sha512sum a.iso b.iso prints one line per file. With > you save that output in a list to verify later.

Is sha512sum good for storing passwords?

No. A fast digest does not protect passwords: slow functions designed for that, such as bcrypt or argon2, exist instead.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course