Annotation of pkgsrc/sysutils/same/files/same.1, revision 1.3
1.3 ! wiz 1: .\" $NetBSD: same.1,v 1.2 2006/08/04 22:46:27 rillig Exp $
1.2 rillig 2: .Dd July 14, 2004
3: .Dt SAME 1
4: .Sh NAME
5: .Nm same
6: .Nd link identical files to save disk space
7: .Sh SYNOPSIS
8: .Nm
9: .Fl HVcdhnstuvz
10: .Sh DESCRIPTION
11: .Nm
12: takes a list of files (e.g. the output of find . -type f) on stdin.
13: Each of the files is compared against each of the others.
14: Whenever two files are found that match exactly, the two files are
15: linked (soft or hard) together.
16: .Ss Goal
1.1 minskim 17: The goal of this program is to conserve disk space when you have
1.2 rillig 18: several different trees of large projects on your disk.
19: By creating hardlinks or softlinks between the files that are the same,
20: you can save lots of disk space.
21: For example, two different versions of the Linux kernel only differ in a
22: small number of files.
23: By running this program you only need to store the contents of those
24: files once.
1.1 minskim 25: This is especially useful if you have different versions of complete
1.2 rillig 26: trees lying around.
27: .Ss Implementation
1.1 minskim 28: The filesize of every file is used as an indication of wether two
29: files can be the same. Whenever the filesizes match, the hashes of
30: these two files are compared. Whenever these match, the file
31: contents are compared. For every matching pair one of the two
32: files is replaced by a hard link to the other file.
1.2 rillig 33: With the -s option a softlink is used.
34: .Pp
1.1 minskim 35: To allow you to do this incrementally, the "rm" is done on the file
36: with the least links. This allows you to "merge" a new tree with
37: several trees that have already been processed. The new tree has
38: link count 1, while the old tree has a higher link count for those
39: files that are likely candidates for linkage.
1.2 rillig 40: .Pp
1.1 minskim 41: The current implementation keeps the "first" incantation of a file,
42: and replaces further occurrances of the same file. This is
1.2 rillig 43: significant when using softlinks.
44: .Ss Options
45: .Bl -tag -width xxxxxx
46: .It Fl H Ar n , Fl -hashstart Ar n
47: Start at hash value
48: .Ar n
49: instead of 0.
50: .It Fl V , Fl -version
51: Print the version of the program and exit.
52: .It Fl c Ar file , Fl -cache Ar file
53: Keep a cache between runs in file
54: .Ar file .
55: .It Fl d , Fl -debug
56: Output some debug messages.
57: .It Fl h , Fl -help
58: Output this page and exit successfully.
59: .It Fl n , Fl -dryrun
60: Only simulate.
61: .It Fl s , Fl -softlinks
62: Create soft links instead of hard links.
63: .It Fl u , Fl -user
64: Don't relink files owned by another user.
65: .It Fl v , Fl -verbose
66: Output verbose messages.
67: .It Fl z , Fl -nullfiles
68: Link empty files, too.
69: By default, only non-empty files are linked.
70: .El
71: .Sh EXIT STATUS
72: Zero on success, non-zero on failure.
73: .Sh EXAMPLES
74: .Bd -literal
75: find . -type f -print | same
76: .Ed
77: .Sh SEE ALSO
78: .Xr find 1
79: .Sh AUTHORS
1.3 ! wiz 80: .An "Roger E. Wolff" Aq Mt R.E.Wolff@BitWizard.nl ,
! 81: .An "Geert Uytterhoeven" Aq Mt geert@linux-m68k.org ,
! 82: .An "Roland Illig" Aq Mt roland.illig@gmx.de .
1.2 rillig 83: .Sh CAVEATS
84: .Bl -bullet
85: .It
1.1 minskim 86: If your editor does not move the original aside before writing a
87: new copy, you will change the file in ALL incarnations when
1.2 rillig 88: editing a file.
89: Patch works just fine: it moves the original aside before creating a new
90: copy.
91: I'm confident that I could learn Emacs to do it this way too.
92: I'm too lazy to figure it out, so if you happen to know an easy way how
93: to do this, please Email me at
94: .Aq R.E.Wolff@BitWizard.nl .
95: .It
96: There is a 1024 (BUFSIZE) character limit to pathnames when using
97: symlinks.
98: .El
CVSweb <webmaster@jp.NetBSD.org>