checksum.sh is quite a simple utility intended for verifying the
integrity of files in arhives and backups. It recursively saves the
MD5 checksums of all files inside
each directory to a special file named
.md5, and can then later
verify the files against those saved checksums.
checksum.sh is released under the
GNU General Public License, version 2.
Hidden files starting with a dot (.) and all symlinks are
ignored. Also, no list of subdirectories is not saved into the
checksum file. checksum.sh does, however, output a complete sorted
list of all files and their checksums when it runs. That can be saved
to a file and any changes can then be found by comparing the stored
file with the current output. It can be a little hard to spot the
changes (lines starting with -, +, , or !) from the full output but
it is super easy to grep them with `checksum.sh -c . | grep
checksum.sh is designed to be compatible with the
md5sum command (which it calls
to calculate the checksums) and the
.md5 for a directory
(non-recursive) can be generated directly with
md5sum * > .md5. The
files can also be verified with
md5sum -c .md5.
While MD5 is considered to be no longer a secure hash, I still think
it to be sufficient for this use. I do not expect malicious changes to
my backups but I do like to be informed about corrupt files. Of
course, nothing stops you changing the script to call
instead if you so desire.
Command Line Help
Usage: checksum.sh -u|-c|-d|-l [directory]
-u/--update - calculate checksums of all files and the them to
a per directorory file named ".md5"
-c/--check - verify files against the saved checksums
-d/--dump - generate a list of all saved checksums
-l/--list - generate a list of current checksums
-h/--help/gibberish - show this help message
checksum.sh always works recursively.
The saved .md5-files are compatible with the md5sum command and can be
generated also with "md5sum -- * > .md5" and checked with
"md5sum -c .md5" for each directory.