1hardlink(1) General Commands Manual hardlink(1)
2
3
4
6 hardlink - Consolidate duplicate files via hardlinks
7
9 hardlink [options] [directory...]
10
12 This manual page documents hardlink, a program which consolidates
13 duplicate files in one or more directories using hardlinks.
14
15 hardlink traverses one or more directories searching for duplicate
16 files. When it finds duplicate files, it uses one of them as the mas‐
17 ter. It then removes all other duplicates and places a hardlink for
18 each one pointing to the master file. This allows for conservation of
19 disk space where multiple directories on a single filesystem contain
20 many duplicate files.
21
22 Since hard links can only span a single filesystem, hardlink is only
23 useful when all directories specified are on the same filesystem.
24
26 -c, --content
27 Compare only the contents of the files being considered for con‐
28 solidation. Disregards permission, ownership and other differ‐
29 ences.
30
31 -f, --force
32 Force hardlinking across file systems.
33
34 -n, --dry-run
35 Do not perform the consolidation; only print what would be
36 changed.
37
38 -v, --verbose
39 Print summary after hardlinking. The option may be specified
40 more than once. In this case (e.g. -vv) it prints every
41 hardlinked file and bytes saved.
42
43 -x, --exclude regex
44 Exclude files and directories matching pattern from hardlinking.
45
46 The optional pattern for excluding files and directories must be
47 a PCRE2 compatible regular expression. Only the basename of the
48 file or directory is checked, not its path. Excluded directo‐
49 ries' contents will not be examined.
50
51 -h, --help
52 Display help text and exit.
53
54 -V, --version
55 Display version information and exit.
56
58 hardlink was written by Jakub Jelinek <jakub@redhat.com> and later mod‐
59 ified by Ruediger Meier <ruediger.meier@ga-group.nl> and Karel Zak
60 <kzak@redhat.com> for util-linux.
61
62 Man page written by Brian Long and later updated by Jindrich Novy
63 <jnovy@redhat.com>
64
66 hardlink assumes that its target directory trees do not change from
67 under it. If a directory tree does change, this may result in hardlink
68 accessing files and/or directories outside of the intended directory
69 tree. Thus, you must avoid running hardlink on potentially changing
70 directory trees, and especially on directory trees under control of
71 another user.
72
73 Historically hardlink silently excluded any names beginning with
74 ".in.", as well as any names beginning with "." followed by exactly 6
75 other characters. That prior behavior can be achieved by specifying
76 -x '^(\.in\.|\.[^.]{6}$)'
77
79 The hardlink command is part of the util-linux package and is available
80 from https://www.kernel.org/pub/linux/utils/util-linux/.
81
82
83
84 hardlink(1)