sumx
Print the checksum and block count of each FILE.
Mirrors GNU sum. Run it as sumx, or as gnux sumx.
Synopsis
sumx [OPTION]... [FILE]...GNU reference
Description
sumx prints a 16-bit checksum of each FILE and the number of blocks it takes up, followed by its name when FILE operands are given, as GNU sum 9 does. With no FILE, or when FILE is -, it reads standard input. By default (and with -r) it computes the BSD checksum, printed with five digits, and counts 1024-byte blocks; -s (--sysv) computes the System V checksum and counts 512-byte blocks. Both are the checksums cksumx prints with -a bsd and -a sysv. They exist to compare with old systems' output and catch accidental corruption only: use sha256sumx to verify a download. GNU lets the last of -r and -s win; gnux cannot see their order, so -s wins whenever it is given. A FILE that cannot be read is reported and the rest are still summed.
Permissions
Needs read permission on each FILE. Writes nothing.
Use cases
- Comparing a file with a checksum published by an old Unix system or a legacy manual.
- Quickly spotting that two copies of a file differ.
- Reproducing the output of sum in a script that expects it.
- Checking System V checksums with
-s. - Getting a file's size in kilobyte blocks along with its checksum.
Flags
--help display this help and exit
-s, --sysv use the System V sum algorithm, use 512-byte blocks
--version output version information and exitExamples
Print the BSD checksum and 1K-block count of a file
sumx README.md36979 1 README.mdPrint the System V checksum and 512-byte block count
sumx -s README.mdChecksum several files at once
sumx *.txtChecksum standard input
printfx 'hello\n' | sumx36979 1Compare two copies of a file
[ "$(sumx < a.bin)" = "$(sumx < b.bin)" ] && echox sameAsk for the BSD algorithm explicitly
sumx -r archive.tarMix standard input with files
catx header.txt | sumx - body.txtKeep a checksum list for later comparison
sumx -s *.cfg > sums.txtGet the same checksum through cksumx
cksumx -a bsd README.mdChecksum every file under a directory in the portable gnux shell
gnux shell -c 'findx . -type f | xargsx sumx'Options
Each option has a page of its own, with its usage and examples.
- -s, --sysv: Use the System V sum algorithm, use 512-byte blocks.
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
sumx --help # options, first examples, exit status
gnux help sumx # this page: the full manual
gnux help sumx --OPTION # one option in depth, with its examples