brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: sha256sum -c --ignore-missing checks only the files you actually downloaded

Files
~/tips/tip-sha256sum-ignore-missing

sha256sum -c --ignore-missing SHA256SUMS

Verify only the downloaded files against a big checksum list, without errors for the rest.

Projects often publish one checksum file for every download, and I usually only grab one or two of those files. Check the whole list and sha256sum complains about everything you don’t have.

Put the checksum file next to your download and add --ignore-missing:

sha256sum -c --ignore-missing SHA256SUMS

Without the flag, every listed file that isn’t there prints FAILED open or read, followed by a warning that listed files could not be read, and the exit code is 1. With it, missing files are skipped and you only see the files you have, for example a.txt: OK.

In a script you can add --quiet as well. It hides the OK lines, so a clean run prints nothing and only a mismatch shows up:

sha256sum -c --ignore-missing --quiet SHA256SUMS && echo verified

A caveat: a checksum file from the same server as the download only proves the download wasn’t damaged. If the server was hacked, both files can be replaced together. When the project signs its checksum file, verify that signature too.

Further reading: sha256sum man page (Debian)

More Files tips xxhsum -H64 backup.tar > backup.xxh unzip -j archive.zip -d out/ Files > More > Select > pick files > More > Compress ls -lhS /var/log file photo.jpg data.bin All Files tips (15) All topics

Link