OS Manuals

/usr/bin/hardlink

Misc binaries for util-linux

From util-linux-misc 2.42.4-r2 (os), captured 2026-11-05 by running hardlink --help (exit 0). permalink

Usage:
 hardlink [options] <directory>|<file> ...

Consolidate duplicate files using hardlinks.

Options:
 -c, --content              compare only file contents, same as -pot
 -b, --io-size <size>       I/O buffer size for file reading
                              (speedup, using more RAM)
 -d, --respect-dir          directory names have to be identical
 -f, --respect-name         filenames have to be identical
 -F, --prioritize-trees     files found in the earliest specified top-level
                              directory have higher priority (but this has
                              lower precedence than --maximize/--minimize)
 -i, --include <regex>      regular expression to include files/dirs
 -l, --list-duplicates      just list paths of duplicates, don't link them
 -m, --maximize             keep the file with the most links
 -M, --minimize             keep the file with the fewest links
     --mount                stay within the same filesystem
 -n, --dry-run              don't actually link anything
 -o, --ignore-owner         ignore owner changes
 -O, --keep-oldest          keep the oldest file of multiple equal files
                              (lower precedence than minimize/maximize)
 -p, --ignore-mode          ignore changes of file mode
 -q, --quiet                quiet mode - don't print anything
 -r, --cache-size <size>    memory limit for cached file content data
     --reflink[=<when>]     create clone/CoW copies (auto, always, never)
     --skip-reflinks        skip already cloned files (enabled on --reflink)
 -s, --minimum-size <size>  minimum size for files
 -S, --maximum-size <size>  maximum size for files
 -t, --ignore-time          ignore timestamps (when testing for equality)
 -v, --verbose              verbose output (repeat for more verbosity)
 -x, --exclude <regex>      regular expression to exclude files
     --exclude-subtree <regex>  regular expression to exclude directories
 -X, --respect-xattrs       respect extended attributes
 -y, --method <name>        file content comparison method
 -z, --zero                 delimit output with NULs instead of newlines

 -h, --help                 display this help
 -V, --version              display version

For more details see hardlink(1).
Options (29)
OptionDescriptionSource
-c, --contentConsider only file content, not attributes, when determining whether two files are equal.help + man
-b, --io-size sizeThe size of the read(2) or sendfile(2) buffer used when comparing file contents.help + man
-d, --respect-dirOnly try to link files with the same directory name.help + man
-f, --respect-nameOnly try to link files with the same (base)name.help + man
-F, --prioritize-treesfiles found in the earliest specified top-level directory have higher priority (but this has lower precedence than --maximize/--minimize)help + man
-i, --include regexregular expression to include files/dirshelp + man
-l, --list-duplicatesDon’t link anything, but list the absolute path of every duplicate file, one per line, preceded by a unique 16-byte discriminator and a tab.help + man
-m, --maximizeAmong equal files, keep the file with the highest link count.help + man
-M, --minimizeAmong equal files, keep the file with the lowest link count.help + man
--mountDo not traverse directories on different filesystems (remain within the same filesystem).help + man
-n, --dry-runDo not act, just print what would happen.help + man
-o, --ignore-ownerLink and compare files even if their owner information (user and group) differs.help + man
-O, --keep-oldestkeep the oldest file of multiple equal files (lower precedence than minimize/maximize)help + man
-p, --ignore-modeLink and compare files even if their mode is different.help + man
-q, --quietQuiet mode, don’t print anything.help + man
-r, --cache-size sizeThe size of the cache for content checksums.help + man
--reflink whenCreate copy-on-write clones (aka reflinks) rather than hardlinks.help + man
--skip-reflinksskip already cloned files (enabled on --reflink)help + man
-s, --minimum-size sizeThe minimum size to consider.help + man
-S, --maximum-size sizeThe maximum size to consider.help + man
-t, --ignore-timeLink and compare files even if their time of modification is different.help + man
-v, --verboseVerbose output, explain to the user what is being done.help + man
-x, --exclude regexA regular expression that excludes files from being compared and linked.help + man
--exclude-subtree regexA regular expression that excludes entire directories from being compared and linked.help + man
-X, --respect-xattrsOnly try to link files with the same extended attributes.help + man
-y, --method nameSet the file content comparison method.help + man
-z, --zeroSeparate lines with a NUL byte instead of a newline (for -l).help + man
-h, --helpDisplay help text and exit.help + man
-V, --versionDisplay version and exit.help + man

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.