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