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