]> git.ipfire.org Git - thirdparty/util-linux.git/blame - misc-utils/hardlink.1.adoc
github: fix asciidoctror dependence
[thirdparty/util-linux.git] / misc-utils / hardlink.1.adoc
CommitLineData
295b3979 1//po4a: entry man manual
6c64d12d
MB
2////
3SPDX-License-Identifier: MIT
4
5Copyright (C) 2008 - 2012 Julian Andres Klode. See hardlink.c for license.
6Copyright (C) 2021 Karel Zak <kzak@redhat.com>
7////
8= hardlink(1)
9:doctype: manpage
10:man manual: User Commands
11:man source: util-linux {release-version}
12:page-layout: base
13:command: hardlink
14
15== NAME
16
17hardlink - link multiple copies of a file
18
19== SYNOPSIS
20
21*hardlink* [options] [_directory_|_file_]...
22
23== DESCRIPTION
24
25*hardlink* is a tool which replaces copies of a file with hardlinks, therefore saving space.
26
27== OPTIONS
28
29*-h*, *--help*::
2c646c80 30print quick usage details to the screen.
6c64d12d
MB
31
32*-v*, *--verbose*::
2c646c80 33More verbose output. If specified once, every hardlinked file is displayed, if specified twice, it also shows every comparison.
6c64d12d
MB
34
35*-q*, *--quiet*::
2c646c80 36Quiet mode, don't print anything.
6c64d12d
MB
37
38*-n*, *--dry-run*::
2c646c80 39Do not act, just print what would happen.
6c64d12d
MB
40
41*-f*, *--respect-name*::
2c646c80 42Only try to link files with the same (basename). It's strongly recommended to use long options rather than *-f* which is interpreted in a different way by others *hardlink* implementations.
6c64d12d
MB
43
44*-p*, *--ignore-mode*::
2c646c80 45Link/compare files even if their mode is different. This may be a bit unpredictable.
6c64d12d
MB
46
47*-o*, *--ignore-owner*::
2c646c80 48Link/compare files even if their owner (user and group) is different. It is not predictable.
6c64d12d
MB
49
50*-t*, *--ignore-time*::
2c646c80 51Link/compare files even if their time of modification is different. You almost always want this.
6c64d12d
MB
52
53*-X*, *--respect-xattrs*::
2c646c80 54Only try to link files with the same extended attributes.
6c64d12d
MB
55
56*-m*, *--maximize*::
2c646c80 57Among equal files, keep the file with the highest link count.
6c64d12d
MB
58
59*-M*, *--minimize*::
2c646c80 60Among equal files, keep the file with the lowest link count.
6c64d12d
MB
61
62*-O*, *--keep-oldest*::
2c646c80 63Among equal files, keep the oldest file (least recent modification time). By default, the newest file is kept. If *--maximize* or *--minimize* is specified, the link count has a higher precedence than the time of modification.
6c64d12d
MB
64
65*-x*, *--exclude* _regex_::
2c646c80 66A regular expression which excludes files from being compared and linked.
6c64d12d
MB
67
68*-i*, *--include* _regex_::
2c646c80 69A regular expression to include files. If the option *--exclude* has been given, this option re-includes files which would otherwise be excluded. If the option is used without *--exclude*, only files matched by the pattern are included.
6c64d12d
MB
70
71*-s*, *--minimum-size* _size_::
2c646c80 72The minimum size to consider. By default this is 1, so empty files will not be linked. The _size_ argument may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning as "KiB").
6c64d12d
MB
73
74== ARGUMENTS
75
76*hardlink* takes one or more directories which will be searched for files to be linked.
77
78== BUGS
79
80The original *hardlink* implementation uses the option *-f* to force hardlinks creation between filesystem. This very rarely usable feature is no more supported by the current hardlink.
81
82*hardlink* assumes that the trees it operates on do not change during operation. If a tree does change, the result is undefined and potentially dangerous. For example, if a regular file is replaced by a device, hardlink may start reading from the device. If a component of a path is replaced by a symbolic link or file permissions change, security may be compromised. Do not run hardlink on a changing tree or on a tree controlled by another user.
83
84== AUTHOR
85
86There are multiple *hardlink* implementations. The very first implementation is from Jakub Jelinek for Fedora distribution, this implementation has been used in util-linux between versions v2.34 to v2.36. The current implementations is based on Debian version from Julian Andres Klode.
87
88include::../man-common/bugreports.adoc[]
89
90include::../man-common/footer.adoc[]
91
92ifdef::translation[]
93include::../man-common/translation.adoc[]
94endif::[]