===== Checksum entire folders ===== ==== Generate checksum ==== To generate/calculate MD5 checksums for an entire folder, we can do this recursively with find. find -type f -exec md5sum "{}" + > checksums.txt This will generate the checksum for every file in the folder and save it to a text file. Technically, MD5 sums aren't the best anymore but it's fast and nothing we're doing needs security anyways, so it's a good quick sanity check. **NOTE: I recommend using SHA-256 or SHA-512 over MD5 for anything important.** I have found that SHA-512 is actually faster then SHA-256, so if you have the space, you might as well use it. find -type f -exec sha512sum "{}" + > checksums.txt ==== Verify checksum ==== To verify that all the files are intact, just make sure it matches. md5sum -c checksums.txt This will run through and verify everything is good. Alternatively, if you used SHA-512, then just replace md5sum with sha512sum. sha512sum -c checksums.txt ==== Note on hash functions ==== MD5 is not secure anymore, but I was curious if the speed is a worthwhile tradeoff. To find out which method is faster, you can use OpenSSL: openssl speed sha256 sha512 md5 For me, the results are as follows: MD5 > SHA-512 > SHA-256 The 'numbers' are in 1000s of bytes per second processed. type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes md5 84098.48k 196370.90k 361047.62k 459072.69k 496273.01k 495352.10k sha256 42210.06k 94892.37k 165544.29k 200256.39k 211776.94k 212728.10k sha512 29820.25k 121823.76k 181359.94k 252842.09k 289037.40k 296808.81k