bashgnuchecksumgnu-coreutils

cksum command doesn't recognize -a option


I'm trying to automate checksum generation with CRC32, SHA1, and SHA256 algorithms on a directory of files, and I'm getting errors from cksum (v.8.32)

According to the cksum manual at gnu.org, it recognizes the option -a or --algorithm to choose from a list of supported checksum algorithms (including sha1, sha256, and crc), but it does not appear to be working.

The command:

cksum -a sha1 foo.txt

Gives the error message:

cksum: invalid option -- 'a'
Try 'cksum --help' for more information.

I tried running cksum --help, but it only prints the following:

Usage: cksum [FILE]...
  or:  cksum [OPTION]
Print CRC checksum and byte counts of each FILE.

      --help     display this help and exit
      --version  output version information and exit

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Full documentation <https://www.gnu.org/software/coreutils/cksum>
or available locally via: info '(coreutils) cksum invocation'

And the resources it points me to are not helpful.

What is going wrong? Is there a better approach to take?


Solution

  • You need GNU Coreutils >= 9.0 (i.e. cksum version >= 9.0)

    Here's what the changelog for version 9.0 says:

    cksum now supports the -a option to select any digest.