I can check the content of several files in a directory against checksums contained in a file named for example SHA256SUMS with sha256sum -c SHA256SUMS.

  1. Is there an easy way to generate a SHA256SUMS file for all files in a directory?

  2. What is the exact syntax of the SHA256SUMS file and where is the documentation (if any) of that syntax?

  • 1
    What is your operating system? – DavidPostill Jul 14 '15 at 12:37
  • Using Bash on Ubuntu. But I hope to get an answer that works on most linuxes. – Gustave Jul 14 '15 at 12:40
  • Solved it now with: sha256sum -b * > SHA256SUMS. Part 2 of question is still open. – Gustave Jul 14 '15 at 12:41
  • See my answer for your part 2. – DavidPostill Jul 14 '15 at 12:46

Probably not the best solution, but it worked for me:

cd directory
sha256sum -b * > SHA256SUMS

Don't know what it does if there are sub-directories in directory. For documentation see DavidPostill's answer.


Where is the documentation for sha256sums?

The GNU Core Utils documentation for md5sum can be found at:

In addition:

The full documentation for sha256sum is maintained as a Texinfo manual. If info and sha256sum are properly installed at your site, the command

info coreutils 'sha256sum invocation'

should give you access to the complete manual.

Source sha256sum — compute and check SHA256 message digest


sha256sum -b does not work recursively

Do this: find . -type f -exec sha256sum {} > checksums.txt \;

-type -f is needed to exclude directories , -exec rather than -execdir in order to get the path included in the checksums list, which facilitates automatic checking

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.