sha384sumx
Print or check SHA-384 (384-bit) checksums.
Mirrors GNU sha384sum. Run it as sha384sumx, or as gnux sha384sumx.
Synopsis
sha384sumx [OPTION]... [FILE]...GNU reference
Description
sha384sumx prints or checks SHA-384 message digests (FIPS 180-4, 384 bits). For each FILE it prints one line: the digest in hexadecimal, a space, a mode mark (a space for text mode, '*' with -b), and the file name. With no FILE, or when FILE is -, it reads standard input. Files are always read as bytes, so -b and -t change only the mark; when both are given, -t wins. --tag prints BSD-style lines instead ('ALGORITHM (FILE) = DIGEST'). A file name containing a backslash, newline or carriage return is escaped and its line starts with a backslash, unless -z ends lines with NUL instead. -c reads such lines (in either style) from the FILEs and checks each listed file, printing 'FILE: OK' or 'FILE: FAILED' and a summary warning of mismatches, unreadable files and improperly formatted lines; --quiet drops the OK lines, --status prints nothing, --ignore-missing skips listed files that do not exist, -w warns about each improperly formatted line and --strict fails because of them. The exit status is 0 when everything was read (and, with -c, matched), 1 otherwise. On Windows a backslash in a file name is the path separator, so it is not escaped as GNU escapes it on Unix; a name with a newline is still escaped.
Permissions
Needs read permission on each FILE (and, with -c, on the checksum lists and every file they name) and search permission on the directories leading to them. Nothing is ever modified. On a terminal, gnux's terminal view colors OK and FAILED in -c output and ends each list with a count ('3 OK, 1 FAILED'); piped or redirected output is exactly GNU's, and --pretty=never or GNUX_PRETTY=never turns it off.
Use cases
- Verifying a download against the checksum its publisher lists.
- Recording digests of release artifacts so users can check them.
- Detecting whether files changed between two points in time.
- Finding duplicate files by comparing their digests.
- Checking a backup or a copy against the original.
Flags
-b, --binary read in binary mode
-c, --check read checksums from the FILEs and check them
--help display this help and exit
--ignore-missing don't fail or report status for missing files
--pretty WHEN[="always"] the gnux terminal view WHEN: 'always' (the default when WHEN is omitted), 'auto' (the default: on a terminal only), or 'never'; GNUX_PRETTY sets the default
--quiet don't print OK for each successfully verified file
--status don't output anything, status code shows success
--strict exit non-zero for improperly formatted checksum lines
--tag create a BSD-style checksum
-t, --text read in text mode (default)
--theme NAME color the view with the built-in theme NAME (gnux theme picks and saves one); GNUX_THEME sets the default
--version output version information and exit
-w, --warn warn about improperly formatted checksum lines
-z, --zero end each output line with NUL, not newline, and disable file name escapingExamples
You downloaded an installer: print its digest to compare with the one on the website
sha384sumx ubuntu-24.04-desktop-amd64.isoVerify the download against the publisher's checksum file, which lists other files too
sha384sumx -c --ignore-missing sha384.sumsubuntu-24.04-desktop-amd64.iso: OKPublish checksums next to your release archives
sha384sumx dist/*.tar.gz > dist/sha384.sumsCheck that a backup copied to a USB drive still matches the original
sha384sumx photos.tar /media/usb/photos.tarFind duplicate photos in a folder: files with the same digest have the same content
sha384sumx *.jpg | sortx | uniqx -w 96 -DIn CI, fail the build when a vendored file was changed by hand
sha384sumx -c --status vendor.sha384sums || { echox 'vendored files changed' >&2; exit 1; }Re-check a large archive set and show only what no longer matches
sha384sumx -c --quiet sha384.sumsnotes.txt: FAILED
sha384sumx: WARNING: 1 computed checksum did NOT matchHash a token from a variable, without the newline echo would add
printfx '%s' "$TOKEN" | sha384sumxWrite lines that name the algorithm, so a mixed list can be checked with cksumx -c
sha384sumx --tag release.tar.gz >> CHECKSUMSRefuse a checksum list with malformed lines instead of skipping them
sha384sumx -c --strict -w sha384.sumsMatch the '*' binary-mode lines produced by tools on Windows
sha384sumx -b setup.exeRecord a digest next to the file in the portable gnux shell, the same on every OS
gnux shell -c 'sha384sumx file.iso > file.iso.sha384sum'Options
Each option has a page of its own, with its usage and examples.
- -b, --binary: Read in binary mode.
- -c, --check: Read checksums from the FILEs and check them.
- --ignore-missing: Don't fail or report status for missing files.
- --pretty: The
gnuxterminal view WHEN: 'always' (the default when WHEN is omitted), 'auto' (the default: on a terminal only), or 'never'; GNUX_PRETTY sets the default. - --quiet: Don't print OK for each successfully verified file.
- --status: Don't output anything, status code shows success.
- --strict: Exit non-zero for improperly formatted checksum lines.
- --tag: Create a BSD-style checksum.
- -t, --text: Read in text mode (default).
- --theme: Color the view with the built-in theme NAME (
gnuxtheme picks and saves one); GNUX_THEME sets the default. - -w, --warn: Warn about improperly formatted checksum lines.
- -z, --zero: End each output line with NUL, not newline, and disable file name escaping.
Exit status
| Status | Meaning |
|---|---|
| 0 | success: every operand was processed |
| 1 | failure: an operand could not be processed (diagnosed on standard error), or a command-line mistake |
Help in the terminal
sha384sumx --help # options, first examples, exit status
gnux help sha384sumx # this page: the full manual
gnux help sha384sumx --OPTION # one option in depth, with its examples