hardlink(1) — Linux manual page

NAME | SYNOPSIS | DESCRIPTION | OPTIONS | BUGS | AUTHORS | AVAILABILITY | COLOPHON

hardlink(1)              General Commands Manual             hardlink(1)

NAME         top

       hardlink - Consolidate duplicate files via hardlinks

SYNOPSIS         top

       hardlink [options] [directory...]

DESCRIPTION         top

       This manual page documents hardlink, a program which consolidates
       duplicate files in one or more directories using hardlinks.

       hardlink 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.

       Since hard links can only span a single filesystem, hardlink is
       only useful when all directories specified are on the same
       filesystem.

OPTIONS         top

       -c, --content
              Compare only the contents of the files being considered
              for consolidation.  Disregards permission, ownership and
              other differences.

       -f, --force
              Force hardlinking across file systems.

       -n, --dry-run
              Do not perform the consolidation; only print what would be
              changed.

       -v, --verbose
              Print summary after hardlinking. The option may be
              specified more than once. In this case (e.g., -vv) it
              prints every hardlinked file and bytes saved.

       -x, --exclude regex
              Exclude files and directories matching pattern from
              hardlinking.

              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.

       -h, --help
              Display help text and exit.

       -V, --version
              Display version information and exit.

BUGS         top

       hardlink assumes that its target directory trees do not change
       from under it.  If a directory tree does change, this may result
       in hardlink accessing files and/or directories outside of the
       intended directory tree.  Thus, you must avoid running hardlink
       on potentially changing directory trees, and especially on
       directory trees under control of another user.

       Historically hardlink 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
       -x '^(\.in\.|\.[^.]{6}$)'

AUTHORS         top

       hardlink 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.

       Man page written by Brian Long and later updated by Jindrich Novy
       <jnovy@redhat.com>

AVAILABILITY         top

       The hardlink command is part of the util-linux package and is
       available from
       https://www.kernel.org/pub/linux/utils/util-linux/.

COLOPHON         top

       This page is part of the util-linux (a random collection of Linux
       utilities) project.  Information about the project can be found
       at ⟨https://www.kernel.org/pub/linux/utils/util-linux/⟩.  If you
       have a bug report for this manual page, send it to
       util-linux@vger.kernel.org.  This page was obtained from the
       project's upstream Git repository
       ⟨git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git⟩ on
       2020-12-18.  (At that time, the date of the most recent commit
       that was found in the repository was 2020-12-17.)  If you
       discover any rendering problems in this HTML version of the page,
       or you believe there is a better or more up-to-date source for
       the page, or you have corrections or improvements to the
       information in this COLOPHON (which is not part of the original
       manual page), send a mail to man-pages@man7.org

                                                             hardlink(1)