Usage

First, initialize the directory tree you wish to check.

Here you can decide to run chkbit in

  • split mode, where it stores an index in each directory, or
  • atom mode, where the index is stored in a single file.

See the pros and cons.

For example, go to the documents folder, then run

chkbit init atom .

This will create the index in the current directory that also serves all subfolders. If you know git, this is the same concept.

To add files to your index, run update:

chkbit update .

chkbit will search the current and all subfolders, create hashes, and add them to the store. It will also check existing hashes (skip with -s).

To only verify your files, run

chkbit check .

This is mainly used on your backup to verify that your files are intact (use --workers=1 on spinning disks).

For more info, run

chkbit --help      # shows flags
chkbit tips        # status codes and ignore syntax
chkbit COMMAND -h  # shows flags and help for this command

Repair

chkbit is designed to detect “damage”. To repair your files, you need to think ahead:

  • Backup regularly
  • Run chkbit before each backup
  • Run chkbit after a backup on the backup media (read-only)
  • In case of any issues, restore from a checked backup medium.

Ignore files

Add a .chkbitignore file containing the names of the files/directories you wish to ignore

  • each line should contain exactly one name
  • you may use Unix shell-style wildcards
    • * matches everything except /
    • ? matches any single character except /
    • [seq] matches any character/range in seq
    • [^seq] matches any character/range not in seq
    • \\ escape to match the following character
  • lines starting with # are skipped
  • lines starting with / are only applied to the current directory
  • you can use path/sub/name to ignore a file/directory in a sub path
  • hidden files (starting with a .) are ignored by default unless you use the -d option