]> git.ipfire.org Git - thirdparty/util-linux.git/blob - misc-utils/hardlink.1
hardlink: replace with code from Debian
[thirdparty/util-linux.git] / misc-utils / hardlink.1
1 .\" Copyright (C) 2008 - 2012 Julian Andres Klode. See hardlink.c for license.
2 .\" SPDX-License-Identifier: MIT
3 .TH hardlink 1 "2012-09-17" "0.3"
4 .SH NAME
5 hardlink \- Link multiple copies of a file
6 .SH SYNOPSIS
7 .B hardlink
8 .RI [ option ]...
9 .RI [ directory | file ]...
10 .SH DESCRIPTION
11 .B hardlink
12 is a tool which replaces copies of a file with hardlinks, therefore saving
13 space.
14 .SH OPTIONS
15 .TP
16 .B \-h or \-\-help
17 print quick usage details to the screen.
18 .TP
19 .B \-v or \-\-verbose
20 More verbose output. If specified once, every hardlinked file is displayed,
21 if specified twice, it also shows every comparison.
22 .TP
23 .B \-n or \-\-dry\-run
24 Do not act, just print what would happen
25 .TP
26 .B \-f or \-\-respect\-name
27 Only try to link files with the same (basename).
28 .TP
29 .B \-p or \-\-ignore\-mode
30 Link/compare files even if their mode is different. This may be a bit unpredictable.
31 .TP
32 .B \-o or \-\-ignore\-owner
33 Link/compare files even if their owner (user and group) is different. It is not
34 predictable
35 .TP
36 .B \-t or \-\-ignore\-time
37 Link/compare files even if their time of modification is different. You almost
38 always want this.
39 .TP
40 .B \-X or \-\-respect\-xattrs
41 Only try to link files with the same extended attributes.
42 .TP
43 .B \-m or \-\-maximize
44 Among equal files, keep the file with the highest link count.
45 .TP
46 .B \-M or \-\-minimize
47 Among equal files, keep the file with the lowest link count.
48 .TP
49 .B \-O or \-\-keep\-oldest
50 Among equal files, keep the oldest file (least recent modification time). By
51 default, the newest file is kept. If \-\-maximize or \-\-minimize is specified,
52 the link count has a higher precedence than the time of modification.
53 .TP
54 .B \-x or \-\-exclude
55 A regular expression which excludes files from being compared and linked.
56 .TP
57 .B \-i or \-\-include
58 A regular expression to include files. If the option \-\-exclude has been given,
59 this option re-includes files which would otherwise be excluded. If the option
60 is used without \-\-exclude, only files matched by the pattern are included.
61 .TP
62 .B \-s or \-\-minimum\-size
63 The minimum size to consider. By default this is 1, so empty files will not
64 be linked. An optional suffix of K,M,G,T may be provided, indicating that the
65 file size is KiB,MiB,GiB,TiB.
66
67 .SH ARGUMENTS
68 .B hardlink
69 takes one or more directories which will be searched for files to be linked.
70
71 .SH BUGS
72 .B hardlink
73 assumes that the trees it operates on do not change during
74 operation. If a tree does change, the result is undefined and potentially
75 dangerous. For example, if a regular file is replaced by a device, hardlink
76 may start reading from the device. If a component of a path is replaced by
77 a symbolic link or file permissions change, security may be compromised. Do
78 not run hardlink on a changing tree or on a tree controlled by another user.
79
80 .B hardlink
81 , as of version 0.3 RC1, improperly calculates the amount of space saved if the
82 option \-\-respect\-name is specified. In previous versions, the amount was
83 wrong in almost all other cases as well.
84
85 .SH AUTHOR
86 The program hardlink and this manpage have been written by Julian Andres Klode,
87 and are licensed under the MIT license. See the code of hardlink for further
88 information.