BRAZ(1) FreeBSD General Commands Manual BRAZ(1) NAME braz - Find and link together identical files. SYNOPSIS braz [-acefgopv] [-n | -s] [-i regex] [-x regex] DESCRIPTION braz searches in the file-tree rooted at the current working directory for identical regular files without crossing file-system boundaries. Files found identical are hard-linked together. The following options are available: -a Restrict linking to files having the same status. This option is a shorthand setting the -f, -g, -o, and -p options. -c Each pair of files to be linked together are byte-to-byte compared to ensure they are really identical. -e Output, after file-system analysis, the number of block that were reclaimed, or, if the -s option was specified, would be reclaimed if the generated script is executed. -f Restrict linking to files having the same user flags. -g Restrict linking to files having the same group ID. -i Specify an inclusion pattern. -n The linking operations will not be undertaken. Implicitly sets the -e option. -o Restrict linking to files having the same owner user ID. -p Restrict linking to files having the same permission flags. -s The linking operations will no be directly undertaken, instead a sh shell-script is produced on stdout. That script, if executed, have the same effect than braz if the -s and -n options are omitted. -v Increase verbosity, more Vs means more verbosity. -x Specify an exclusion pattern. This command is potentially dangerous as the file-tree may be irremedia- bly modified against your wishes if misused or if it's effects are not well understood. It should be used with caution! ALGORITHM braz is build of a two passes algorithm. The first pass completely ex- plores the file tree rooted at the current working directory (without crossing file-system boundaries). Each found files, if regular, are read and their MD5 digest signature is computed and stored. That pass changes the access time of all the examined files. The second pass searches for identical files in the database built by the first pass. Files are sorted according to their digest, in the resulting ordered set subsequent files whose size and digest signatures are the same are considered identical. If two of those files are stored behind a different inode then they are linked together after unlinking one of them. FILES SELECTION The set of files analyzed by braz can be controlled by a set of inclusion and/or exclusion patterns. The patterns are standard extended regular ex- pressions specified via the -i and -x options, respectively for selecting or excluding files. Both kind of patterns can be freely mixed without limit. The string matched against the patterns is the complete path (in- cluding the file name) relative to the root the the examined file-tree. The patterns are applied in the command-line order, the first match is used to select or reject the tested filename depending on the kind of the matched pattern. If not match is found then a default action is used de- pending on the kind of the first specified pattern. If the first specifi- cation is an exclusion pattern then the file is selected for analysis; and similarly if the first pattern is inclusive then the default action is to reject the file. If no pattern is specified then all files are se- lected for analysis. SEE ALSO link(2), unlink(2), re_format(7), sh(1), stat(2). R. Rivest, The MD5 Message-Digest Algorithm, RFC 1321. October 30, 2001 2