1HARDLINK(1) User Commands HARDLINK(1)
2
3
4
6 hardlink - link multiple copies of a file
7
9 hardlink [options] [directory|file]...
10
12 hardlink is a tool which replaces copies of a file with hardlinks,
13 therefore saving space.
14
16 -h, --help
17 print quick usage details to the screen.
18
19 -v, --verbose
20 More verbose output. If specified once, every hardlinked file is
21 displayed, if specified twice, it also shows every comparison.
22
23 -q, --quiet
24 Quiet mode, don’t print anything.
25
26 -n, --dry-run
27 Do not act, just print what would happen.
28
29 -f, --respect-name
30 Only try to link files with the same (basename). It’s strongly
31 recommended to use long options rather than -f which is interpreted
32 in a different way by others hardlink implementations.
33
34 -p, --ignore-mode
35 Link/compare files even if their mode is different. This may be a
36 bit unpredictable.
37
38 -o, --ignore-owner
39 Link/compare files even if their owner (user and group) is
40 different. It is not predictable.
41
42 -t, --ignore-time
43 Link/compare files even if their time of modification is different.
44 You almost always want this.
45
46 -X, --respect-xattrs
47 Only try to link files with the same extended attributes.
48
49 -m, --maximize
50 Among equal files, keep the file with the highest link count.
51
52 -M, --minimize
53 Among equal files, keep the file with the lowest link count.
54
55 -O, --keep-oldest
56 Among equal files, keep the oldest file (least recent modification
57 time). By default, the newest file is kept. If --maximize or
58 --minimize is specified, the link count has a higher precedence
59 than the time of modification.
60
61 -x, --exclude regex
62 A regular expression which excludes files from being compared and
63 linked.
64
65 -i, --include regex
66 A regular expression to include files. If the option --exclude has
67 been given, this option re-includes files which would otherwise be
68 excluded. If the option is used without --exclude, only files
69 matched by the pattern are included.
70
71 -s, --minimum-size size
72 The minimum size to consider. By default this is 1, so empty files
73 will not be linked. The size argument may be followed by the
74 multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on
75 for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g.,
76 "K" has the same meaning as "KiB").
77
79 hardlink takes one or more directories which will be searched for files
80 to be linked.
81
83 The original hardlink implementation uses the option -f to force
84 hardlinks creation between filesystem. This very rarely usable feature
85 is no more supported by the current hardlink.
86
87 hardlink assumes that the trees it operates on do not change during
88 operation. If a tree does change, the result is undefined and
89 potentially dangerous. For example, if a regular file is replaced by a
90 device, hardlink may start reading from the device. If a component of a
91 path is replaced by a symbolic link or file permissions change,
92 security may be compromised. Do not run hardlink on a changing tree or
93 on a tree controlled by another user.
94
96 There are multiple hardlink implementations. The very first
97 implementation is from Jakub Jelinek for Fedora distribution, this
98 implementation has been used in util-linux between versions v2.34 to
99 v2.36. The current implementations is based on Debian version from
100 Julian Andres Klode.
101
103 For bug reports, use the issue tracker at
104 https://github.com/karelzak/util-linux/issues.
105
107 The hardlink command is part of the util-linux package which can be
108 downloaded from Linux Kernel Archive
109 <https://www.kernel.org/pub/linux/utils/util-linux/>.
110
111
112
113util-linux 2.37.2 2021-06-02 HARDLINK(1)