-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathduff.1
157 lines (157 loc) · 3.92 KB
/
duff.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
.\" Copyright (c) Camilla Berglund <[email protected]>
.\" This document is licensed under the zlib/libpng license.
.\" Please see the file `COPYING' for license details.
.\"
.Dd October 6, 2010
.Os
.Dt DUFF 1
.Sh NAME
.Nm duff
.Nd duplicate file finder
.Sh SYNOPSIS
.Nm
.Op Fl HLPaeqprtz
.Op Fl f Ar format
.Op Fl l Ar limit
.Op Ar
.Nm
.Op Fl h
.Nm
.Op Fl v
.Sh DESCRIPTION
The
.Nm
utility reports any clusters of duplicates in the specified files and/or directories.
For each cluster of duplicate files,
.Nm
prints a customizable header on one line,
and then the names of all the files in the cluster, each on one line.
.Pp
If no files are specified as arguments,
.Nm
reads file names from stdin.
.Pp
Note that as of version 0.5
.Nm
ignores symbolic links to files, as that behavior was conceptually broken.
Therefore, the
.Fl H , L
and
.Fl P
options now apply only to directories.
.Pp
The following options are available:
.Bl -tag -width indent
.It Fl H
Follow symbolic links listed on the command line.
This overrides any previous
.Fl L
or
.Fl P
option.
Note that this only applies to directories, as symbolic links to files are never followed.
.It Fl L
Follow all symbolic links.
This overrides any previous
.Fl H
or
.Fl P
option.
Note that this only applies to directories, as symbolic links to files are never followed.
.It Fl P
Don't follow any symbolic links.
This overrides any previous
.Fl H
or
.Fl L
option.
This is the default.
Note that this only applies to directories, as symbolic links to files are never followed.
.It Fl a
Include hidden files and directories when searching recursively.
.It Fl e
Excess mode. List all excess files; i.e. all but one of each cluster of duplicates.
This is useful when you want to automate removal of duplicate files.
.It Fl f Ar format
Set the format of the cluster header.
If the header is set to the empty string, no header line is printed.
.Pp
The following escape sequences are available:
.Bl -hang -offset left
.It Cm %n
The number of files in the cluster.
.It Cm %c
The SHA1 checksum of files in the cluster.
.It Cm %i
The one-based index of the file cluster.
.It Cm %s
The size, in bytes, of a file in the cluster.
.It Cm %%
A
.Sq %
character.
.El
.Pp
The default format string is:
.Pp
.Dl %n files in cluster %i (%s bytes, checksum %c)
.It Fl h
Display help information and exit.
.It Fl l Ar limit
The minimum size of files to be sampled.
If the size of files in a cluster is equal or greater than the specified limit,
.Nm
will sample a few bytes from each file, before calculating a full checksum.
This is an optimization for larger files.
The default limit is 1048576 bytes.
.It Fl q
Quiet mode.
Supress warnings and error messages.
.It Fl p
Physical mode.
Make
.Nm
consider physical files instead of hard links.
If specified, multiple hard links to the same physical file will not be reported as duplicates.
.It Fl r
Recursively search into all specified directories.
.It Fl t
Thorough mode.
Distrust checksums as a guarantee for equality.
In thorough mode,
.Nm
compares files byte by byte when their checksums match.
.It Fl v
Display version information and exit.
.It Fl z
Do not consider files with zero size to be equal.
This option suppresses reporting a cluster of empty files.
.El
.Sh EXAMPLES
.\" TODO: Fix the formatting of the example commands.
The command:
.Dl duff -e * \&| xargs rm
.Pp
removes all duplicate files in the current directory.
.Pp
The command:
.Dl duff -r foo/
.Pp
lists all duplicate files in the directory foo and its subdirectories.
.Pp
The command:
.Dl find \&. -name '*.h' \&| duff
.Pp
lists all duplicate header files in the current directory and its subdirectories.
.Sh DIAGNOSTICS
.Ex -std
.Sh "SEE ALSO"
.Xr find 1 ,
.Xr xargs 1
.Sh AUTHORS
.An "Camilla Berglund" Aq [email protected]
.An "James Craig Burley" Aq [email protected]
.Sh BUGS
.Nm
no longer considers symbolic links to files potential duplicates, and will not report them.
This may break scripts relying on the previous behavior.