1hardlink(1) General Commands Manual hardlink(1)
2
3
4
6 hardlink - Consolidate duplicate files via hardlinks
7
9 hardlink [-c] [-n] [-v] [-vv] [-x pattern] [-h] directory1 [ directory2
10 ... ]
11
13 This manual page documents hardlink, a program which consolidates
14 duplicate files in one or more directories using hardlinks.
15
16 hardlink traverses one or more directories searching for duplicate
17 files. When it finds duplicate files, it uses one of them as the mas‐
18 ter. It then removes all other duplicates and places a hardlink for
19 each one pointing to the master file. This allows for conservation of
20 disk space where multiple directories on a single filesystem contain
21 many duplicate files.
22
23 Since hard links can only span a single filesystem, hardlink is only
24 useful when all directories specified are on the same filesystem.
25
27 -c Compare only the contents of the files being considered for
28 consolidation. Disregards permission, ownership and other
29 differences.
30
31 -f Force hardlinking across file systems.
32
33 -n Do not perform the consolidation; only print what would be
34 changed.
35
36 -v Print summary after hardlinking.
37
38 -vv Print every hardlinked file and bytes saved. Also print sum‐
39 mary after hardlinking.
40
41 -x pattern
42 Exclude files and directories matching pattern from hardlink‐
43 ing.
44
45 -h Show help.
46
47 The optional pattern for excluding files and directories must be a
48 PCRE2 compatible regular expression. Only the basename of the file or
49 directory is checked, not its path. Excluded directories' contents will
50 not be examined.
51
53 hardlink was written by Jakub Jelinek <jakub@redhat.com>.
54
55 Man page written by Brian Long.
56
57 Man page updated by Jindrich Novy <jnovy@redhat.com>
58
60 hardlink assumes that its target directory trees do not change from
61 under it. If a directory tree does change, this may result in hardlink
62 accessing files and/or directories outside of the intended directory
63 tree. Thus, you must avoid running hardlink on potentially changing
64 directory trees, and especially on directory trees under control of
65 another user.
66
67 Historically hardlink silently excluded any names beginning with
68 ".in.", as well as any names beginning with "." followed by exactly 6
69 other characters. That prior behavior can be achieved by specifying
70 -x '^(\.in\.|\.[^.]{6}$)'
71
72
73
74 hardlink(1)