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