cfv(1)
๐ธ cfv(1) โ verify ur files, bestie ๐
okay so, picture this: you've got a big ol' pile of files and a checksum file and you need to know if they match. That's cfv (short for "checksum file verifier", iykyk). It verifies that the files you have are the same as those that were used to create the checksum file. She speaks .sfv, .csv, .crc, .md5, md5sum, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, .torrent, par, and par2. Versatile queen โจ
โจ SYNOPSIS โจ
cfv [-p dir] [-v|-V|-VV|-q|-Q] [--progress VAL] [-r|-rr|-R] [-l|-L]
[-n|-N] [--renameformat <s>] [-s|-S] [-zz|-z|-Z|-ZZ] [-T|-C] [-m|-M]
[-i|-I] [-u|-uu|-U] [--encoding <e>] [--unquote <b>] [--fixpaths <s>]
[--strippaths <p>] [--showpaths <i>] [--list/--list0 <l>] [--announceurl
<u>] [--piece_size_pow2 <n>] [--private_torrent] [-t type] [-f file]
[files...]
๐ DESCRIPTION ๐
cfv verifies that the files you have are the same as those that the were used to create the checksum file. That's it. That's the whole job. She's not doing your laundry, she's just checking ur vibes against a manifest ๐ฆ
๐ฅ OPTIONS ๐ฅ
-vโ turn ON extra messages. chatty mode, we love her ๐ฌ-Vโ turn OFF extra messages. (this is the default, she's chill like that)-VVโ same as-V, but she won't even print the status line at the end either. no little goodbye wave ๐-qโ like-VV, except not even error messages get printed. total silence. the way you find out what happened is by checking the exit status. no cap ๐ถ-Qโ only status lines print, individual errors do NOT. halfway quiet.--progress VALโ controls when progress bars show up. Ifno, progress bars are never displayed. Ifauto, they show when the output is going to a tty (this is the default). Ifyes, progress is always displayed. live your truth ๐-rโ recursive mode 1. In create mode, she makes separate chksum files for each dir. one per folder, spreading the love.-rrโ recursive mode 2. In create mode she makes a single file with a deep listing inside it. Both recursive modes are equivalent for test mode, so pick whichever, bestie.-Rโ disable recursive mode (default).-lโ follow directory symlinks in recursive mode. (default)-Lโ don't follow directory symlinks in recursive mode.-Tโ set test mode. (default) This is her main character era.-Cโ set create mode. time to build, not check ๐๏ธ-mโ only check for missing files, don't actually compare checksums. (so u know what's gone, not what's wrong)-Mโ check checksums. (default)-nโ rename bad files. With-s, she'll also rename misnamed files to the correct name. healing era ๐ฉน-Nโ don't rename bad files. (default)--renameformat <string>โ the format string used with the-noption. Simply, put any of the 4 strings%(fullname)s,%(name)s,%(ext)s, and%(count)iin the format string, along with whatever other text you wish. The default is'%(name)s.bad-%(count)i%(ext)s'. In detail, this is a standard python format string with a mapping that contains{'fullname': original filename, 'name': fullname minus extension, 'ext': extension(including .), 'count': rename attempt}. If the format string does not contain count, then cfv will append'-%(count)i'to the filename if the first attempt fails. ๐ (don't overthink it, just vibe with the placeholders)-sโ search for misnamed files. No effect in create mode. Also, keep in mind that using-mtogether with-swill do nothing if the checksum type doesn't include filesizes, and if it does, it can give false positives if some files have the same size. so like, be careful ๐ซฃ-Sโ don't search for misnamed files. (default)-iโ ignore case. Currently has no effect in create mode.-Iโ don't ignore case. (default)-uโ show unverified files. If no files in a directory are verified, she showsdir/*. If no files in a directory or its subdirs are verified, she showsdir/**. Has no effect in create mode. ๐-uuโ show each unverified file individually, no special directory handling. Has no effect in create mode.-Uโ don't show unverified files. (default)-zzโ force making/reading checksum files as gzipped files, even if they don't end in.gz. (mainly useful for"-f -")-zโ make gzipped files in create mode.-Zโ don't create gzipped files automatically. (default)-ZZโ never use gzip, even if the file ends in".gz". she said no ๐ซ--encoding ENCODINGโ specify the encoding to use when reading/writing checksum files. This can be any valid encoding name recognized by Python, or one of the following special values:rawโ read/write as raw byte streams. May be useful for handling invalid filenames on disk or within a checksum file. (For text based checksum file formats, this is how cfv versions prior to 2.0 behaved.) vintage behavior ๐autoโ the default. For checksum file formats that specify their encoding explicitly, that value is used. For text checksum file formats that start with a Unicode BOM (Byte Order Mark), the encoding is detected automatically. Otherwise, Python's notion of the users preferred encoding is used. she's perceptive like that ๐
--unquote BOOLโ ifyes, handle checksum files that were generated by buggy encoders that quote filenames in checksum formats that don't need it. Default isno, since quotes can be a valid character in a filename and we don't want to remove them if they are actually part of the filename. respect the quotes ๐ซถ--fixpaths <string>โ convert all occurrences of any characters in string to the dir separator for the current platform. No effect in create mode. Use an empty string to disable.--strippaths VALโ strip NUM leading components from file names in test mode. Similar to the-p/--stripoptions ofpatch. VAL may be'none': leave exactly as is,'all': strip everything but the filename,0: strip the leading driveletter/slash (if any),1+: strip this many path components in addition. The default is0.--showpaths VALโ show paths in displayed filenames. VAL should be one ofyes/1/no/0/auto/2orabsolute/relative, or one from first list and one from second joined by a-. For backwards compatibility,1=yes,0=none,2=auto. The default isauto-relative. Abrieviations are accepted. Examples:--showpaths=y-aalways shows absolute paths.--showpaths=nnever shows paths. pick ur fighter ๐ฅ-p dirโ change to directory dir before doing anything. get situated first ๐-f fileโ specify the name of the checksum file to test or create. If file is-, stdin (for-T) or stdout (for-C) will be used. pipes, bestie ๐ฐ-t typeโ specify the type of the file. Can besfv,sfvmd5,csv,csv2,csv4,sha1,sha224,sha256,sha384,sha512,md5,bsdmd5,par,par2,torrent,crc,auto, orhelp. If the type ishelp, or an unknown type is given, a list of the types and their descriptions will be printed. The default isauto, which will detect the file type for you. When creating, if type isautoan sfv will be made, unless a different default has been set in the config file.--list listsetโ prints a raw listing of files in the given set (ok,bad,unverified,notfound). Usually used with-q, but not strictly needed since specifying--listwill redirect all other messages to stderr. ๐--list0 listsetโ like--listbut files are separated by a null char. Useful in combination withxargs -0. null-separated supremacy.--announceurl URLโ tracker announce URL for.torrentfile creation. ๐ก--piece_size_pow2 Nโ power of two to set piece size to for.torrentfile creation. The default is18, which gives a piece size of2^18=256KB.--private_torrentโ set the private flag in the torrent during.torrentfile creation. ๐คซ-h/--helpโ print help info.--versionโ print version of cfv and the modules it uses.
๐ซ the tea on the types ๐ซ
sfvis a Simple File Verify format filesfvmd5is a Simple File Verify format file, using MD5 checksums rather than crc32.csvis a Comma Separated Value file, with the fields beingname,size,crc32,csv2is a Comma Separated Value file, with the fields beingname,size,csv4is a Comma Separated Value file, with the fields beingname,size,crc32,pathsha1is a GNU sha1sum format filesha224is a GNU sha224sum format filesha256is a GNU sha256sum format filesha384is a GNU sha384sum format filesha512is a GNU sha512sum format filemd5is a GNU md5sum format filebsdmd5is a BSD md5 format fileparis parchive v1 format file (test-only)par2is parchive v2 format file (test-only)torrentis a BitTorrent metainfo filecrcis a JPEG Sheriff format crc file
๐ EXIT STATUS ๐
The exit status of cfv can be examined to determine what kind of errors, if any, occurred. This is literally the whole point of -q, bestie โ she tells u everything thru the exit code ๐
An exit status of 1 indictates a command line argument error, or an unhandled exception. (yes, that's 1 on its own, not a bitwise OR thing)
Otherwise, the exit status will be a bitwise OR of:
2โ badcrc (a file had a different checksum than listed in the checksum file)4โ badsize (a file had a different size than listed. Not all checksum file formats include file size)8โ notfound (a file that was listed was not found)16โ ferror (some other file error occurred when trying to open/read a file)32โ unverified (a file was not verified, only with-u)64โ cferror (a checksum file was not found or not recognized)
so like, these stack! multiple problems = the numbers add up.2 | 8is10. do the math, she trusts u ๐งฎ
๐ NOTES ๐
Since different platforms represent the path separator differently, using recursive mode 2 (-rr) is not recommended for anything other than personal usage. Although the addition of the fixpaths option can be used to work around this, it isn't guaranteed that whatever program others user have will have a similar feature. lowkey a portability moment ๐ฌ
The -s option is not currently implemented for .torrent files. (Unless you also use -m) ๐
โจ EXAMPLES โจ
If no options are specified, the default will be -T -t auto, and it will search the current directory for any supported checksum files.
cfv
Force the file to test:
cfv -f funny.name
Test only the files you have, (avoid file not found errors):
cfv *
Create a csv file for all the files in the current dir:
cfv -C -tcsv
Create a csv file for only the zip files in the current dir, and specify the filename:
cfv -C -fsomezips.csv *.zip
Check if all files in current and subdirs are verified, but don't verify checksums of files that are. (For example, before writing a directory to a cdr and you want to make sure all the files are verified.):
cfv -r -m -u
๐ CONFIGURATION ๐
Upon startup, cfv will test for ~/.cfvrc and if it exists, read configuration information from it. The file consists of any number of lines, each having a single option name and the value separated by a space. Empty lines and lines beginning with a # are ignored. so u can leave lil notes for urself in there, she won't judge ๐
โจ EXAMPLE CONFIGURATION โจ
okay bestie, here's a whole example .cfvrc that literally specifies all the default options. it's giving "just copy me" energy, and no cap, it's the whole thing:
#this is an example .cfvrc that specifies all the default options
#don't be verbose (set to 1 or v for -v, 0 or V for -V, -1 or VV for
-VV, -2 or q for -q, -3 or Q for -Q)
verbose V
#use progress meter when output is to a terminal (yes for always, no for
never, auto for when output isatty)
progress auto
#create sfv files by default
default sfv
#sort dir listings before creating a checksum file
dirsort 1
#sort command line specified files
cmdlinesort 1
#expand wildcards in command line (yes for always, no for never, auto
for when os.name is os2, nt, or dos)
cmdlineglob auto
#don't be recursive (set to 0 for -R, 1 for -r, 2 for -rr)
recursive 0
#follow symbolic links
dereference 1
#don't show unverified files (set to 0 for -U, 1 for -u, 2 for -uu)
showunverified 0
#don't ignore case
ignorecase 0
#don't use workaround for buggy encoders that quote filenames
unnecessarily
unquote 0
#don't fix any paths (note that there is a single space after fixpaths,
thus the value it gets set to is an empty string)
fixpaths
#A more useful example would be:
#fixpaths /\
#don't strip leading directories (all to strip all path info, 0+ to
strip the leading / and the first X components, none for nothing)
strippaths 0
#show full paths in recursive mode (set to 0 for never, 1 for always, 2
for only in recursive mode)
showpaths 2
#access checksum filenames that end with .gz as gzipped files (-1 for
never, 0 for with .gz, and 1 to make -C make .gz files automatically)
gzip 0
#don't rename bad files
rename 0
#format to use for renaming bad files with -n
renameformat %(name)s.bad-%(count)i%(ext)s
#don't search for files
search 0
#filename_type can be used to override what type of file to create when
-t isn't specified.
#The format of the argument is <typename>=<regex>. Can be specified
multiple times, the earlier instances having higher priority.
#for example, the following line would cause cfv -C -f foo.md5 to create
a 'sfvmd5' file rather than a 'md5' file.
#filename_type sfvmd5=md5$
#torrent options:
# you can specify a default announce url:
#announceurl http://foo.bar/announce
# piece size of 2^18 bytes (256KB):
piece_size_pow2 18
and that's the config, periodt. ๐
๐ FILES ๐
~/.cfvrcโ this is the cfv configuration file, bestie. see the configuration section for all the deets. ๐~/_cfvrcโ alternate configuration file name. (since windows won't let you create files starting with a dot, which is lowkey tragic.) ๐
๐ฟ ENVIRONMENT ๐ฟ
HOMEโ where to look for the cfvrc file. note that win9x doesn't set this to anything automatically. (iykyk, retro struggle.) ๐ซถCFV_NOMMAPโ set this to a non-empty value to disable usage ofmmap. fr fr, no mmap. ๐ซ
๐ AUTHOR ๐
- Matthew Mueller
<donut AT dakotacom DOT net> - Lisa Gnedt
<cfv-project AT davizone DOT at>
the latest version can be found at: https://github.com/cfv-project/cfv
the original project can be found at: http://cfv.sourceforge.net/
๐ SEE ALSO ๐
and that's a wrap on cfv(1), from 05 Feb 2005. it's iconic, it's classic, it's Unix. slay. ๐โจ
๐ฆ where this page comes from
- nixos 26.05: cfv 3.2.0
- nixpkgs unstable: cfv 3.2.0
- ubuntu stonking: cfv 3.2.0-2 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms