Skip to content

Instantly share code, notes, and snippets.

@techie2000
Created December 10, 2020 17:01
Show Gist options
  • Save techie2000/ea3897757652bf04481cdcfa999283e3 to your computer and use it in GitHub Desktop.
Save techie2000/ea3897757652bf04481cdcfa999283e3 to your computer and use it in GitHub Desktop.
Create hardlinks for multiple files
@techie2000
Copy link
Author

or cp -lr <src> <target>

@techie2000
Copy link
Author

techie2000 commented Feb 7, 2021

Let the system find and hardlink duplicate files

https://www.systutorials.com/docs/linux/man/1-hardlink/

hardlink [-c] [-n] [-v] [-vv] [-h] directory1 [ directory2 ... ]

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

-vv,
Print every hardlinked file and bytes saved. Also print summary after hardlinking.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment