Directory Checksum is a command-line utility that recursively calculates checksums for the contents of a directory and can display results down to a user-selected depth. It gives a hierarchical view of what changed rather than returning only one opaque checksum for an entire tree.
The program was created primarily to investigate container image build-cache problems. When Docker, BuildKit, Buildah, or another OCI image builder unexpectedly rebuilds a layer containing COPY or ADD instructions, Directory Checksum can be run inside successive builds. Comparing its output helps identify the file or directory responsible for invalidating the cache, after filtering such as .dockerignore has already been applied.
Files are hashed from their binary content and filesystem metadata such as ownership or creation time is ignored. Directory hashes are derived from the names and checksums of their immediate children. Empty directories therefore participate in the result instead of being silently omitted. Symbolic links are not followed; their target paths are hashed instead.
Output identifies the checksum, object type, and path relative to the directory being scanned. The maximum printed depth can be adjusted to balance detail against output volume.
This is free and open source software.
Key Features
- Recursively calculates checksums for files and directories.
- Prints results to a configurable maximum directory depth.
- Includes empty directories in the calculated hierarchy.
- Uses SHA-1 checksums for files and directory entries.
- Builds directory hashes from the names and checksums of immediate children.
- Does not follow symbolic links and instead hashes their target paths.
- Marks output entries as directories, files, or symbolic links.
- Reports paths relative to the scanned directory.
- Helps debug unexpected Docker, BuildKit, Buildah, and OCI image layer cache invalidation.
Website: github.com/MShekow/directory-checksum
Support:
Developer: Marius Shekow
License: MIT License
Directory Checksum is written in Go. Learn Go with our recommended free books and free tutorials.
Related Software
| CLI Data Hashing Tools | |
|---|---|
| xxHash | Non-cryptographic hash algorithm |
| b3sum | Implementation of the BLAKE3 hash function |
| RHash | Calculate and verify magnet links and various message digests |
| md5sum | Compute and check MD5 message digest; part of GNU Coreutils |
| cfv | Test and create checksum files |
| Jacksum | Work with checksums, CRCs, and message digests |
| md5 | Generate / check MD5 message digest |
| digup | Update md5sum or shasum digest files |
| cksum | Compute and verify file checksums |
| Hashrat | Hash-generation utility |
| ddgst | Hashing and checksum utility |
| QCalcFileHash | Hash calculator |
| hashdir | Checksum directories and files |
| Hash Calculator | Calculates around 50 cryptographic hashes of strings and files |
| dano | Hashdeep/md5tree for media files |
| sha3sum | Keccak, SHA-3, SHAKE, and RawSHAKE checksum utilities |
| luha | Simple file checksum tool |
| filepack | File hashing and verification |
| b2sum | Calculate BLAKE2 checksums |
| cksfv | Create and check sfv listings using CRC32 checksums |
| cksfv.rs | Reimplements the classic cksfv tool |
| hashdeep | Generate and verify file hashes |
| hashit | Generate file hashes quickly |
Read our verdict in the software roundup.
Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more. Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form. |


Please read our Comment Policy before commenting.