]> git.ipfire.org Git - thirdparty/util-linux.git/blame - misc-utils/hardlink.1
hardlink: cleanup verbose and warning messages
[thirdparty/util-linux.git] / misc-utils / hardlink.1
CommitLineData
cabf1c1c
JN
1.TH "hardlink" "1"
2.SH "NAME"
3hardlink \- Consolidate duplicate files via hardlinks
4.SH "SYNOPSIS"
5.PP
551e8963 6\fBhardlink\fP [\fB-c\fP] [\fB-n\fP] [\fB-v\fP] [\fB-vv\fP] [\fB-x pattern\fP] [\fB-h\fP] directory1 [ directory2 ... ]
cabf1c1c
JN
7.SH "DESCRIPTION"
8.PP
94b040b0 9This manual page documents \fBhardlink\fP, a
cabf1c1c
JN
10program which consolidates duplicate files in one or more directories
11using hardlinks.
12.PP
94b040b0 13\fBhardlink\fP traverses one
cabf1c1c
JN
14or more directories searching for duplicate files. When it finds duplicate
15files, it uses one of them as the master. It then removes all other
16duplicates and places a hardlink for each one pointing to the master file.
17This allows for conservation of disk space where multiple directories
18on a single filesystem contain many duplicate files.
19.PP
20Since hard links can only span a single filesystem, \fBhardlink\fP
21is only useful when all directories specified are on the same filesystem.
22.SH "OPTIONS"
23.PP
24.IP "\fB-c\fP" 10
25Compare only the contents of the files being considered for consolidation.
26Disregards permission, ownership and other differences.
348af99a
JZ
27.IP "\fB-f\fP" 10
28Force hardlinking across file systems.
cabf1c1c
JN
29.IP "\fB-n\fP" 10
30Do not perform the consolidation; only print what would be changed.
31.IP "\fB-v\fP" 10
a272f143
JN
32Print summary after hardlinking.
33.IP "\fB-vv\fP" 10
34Print every hardlinked file and bytes saved. Also print summary after hardlinking.
551e8963
TL
35.IP "\fB-x pattern\fP" 10
36Exclude files and directories matching pattern from hardlinking.
cabf1c1c
JN
37.IP "\fB-h\fP" 10
38Show help.
551e8963
TL
39.PP
40The optional pattern for excluding files and directories must be a PCRE2
41compatible regular expression. Only the basename of the file or directory
42is checked, not its path. Excluded directories' contents will not be examined.
cabf1c1c
JN
43.SH "AUTHOR"
44.PP
94b040b0 45\fBhardlink\fP was written by Jakub Jelinek <jakub@redhat.com>.
cabf1c1c 46.PP
bd9a35c6 47Man page written by Brian Long and later updated by Jindrich Novy <jnovy@redhat.com>
94b040b0
JN
48.SH "BUGS"
49.PP
50\fBhardlink\fP assumes that its target directory trees do not change from under
51it. If a directory tree does change, this may result in \fBhardlink\fP
52accessing files and/or directories outside of the intended directory tree.
53Thus, you must avoid running \fBhardlink\fP on potentially changing directory
54trees, and especially on directory trees under control of another user.
551e8963
TL
55.PP
56Historically \fBhardlink\fP silently excluded any names beginning with
57".in.", as well as any names beginning with "." followed by exactly 6
58other characters. That prior behavior can be achieved by specifying
59.br
5aad3c12 60-x '^(\\.in\\.|\\.[^.]{6}$)'
bd9a35c6
KZ
61.SH AVAILABILITY
62The hardlink command is part of the util-linux package and is available from
63https://www.kernel.org/pub/linux/utils/util-linux/.