Imported Upstream version 2.0.0
[platform/upstream/fdupes.git] / fdupes-help.7
1 .TH FDUPES-HELP 7
2
3 .SH NAME
4 fdupes-help \- fdupes interactive mode reference
5
6 .SH "INTRODUCTION"
7 .PP
8 When run interactively
9 .RB ( "" "as " "fdupes --delete" ),
10 fdupes
11 will show a list of duplicates and prompt the user for further action.
12 .PP
13 The user can tell fdupes which files to keep or delete by tagging them accordingly. Once tagged, the user can instruct fdupes to delete any files that have been tagged for deletion. This can be done incrementally, if desired, successively tagging and deleting a limited number of files at a time until no more duplicates remain to be processed.
14
15 There are several ways to tag files in fdupes: individually using the
16 .IR cursor ,
17 by providing a list of files to keep, or by selecting files that match particular search criteria and tagging those as desired. Each of these approaches is discussed in detail in the sections below.
18
19 .SH "SCROLLING THE LIST"
20 .PP
21 The list of duplicates can be scrolled as follows:
22 .B 
23 .IP "PAGE DOWN"
24 Scroll down to the next page.
25
26 .B 
27 .IP "PAGE UP"
28 Scroll up to preceding page.
29
30 .B 
31 .IP "SHIFT + DOWN"
32 Scroll down by one line. Not supported on some terminals.
33
34 .B
35 .IP "SHIFT + UP"
36 Scroll up by one line. Not supported on some terminals.
37
38 .SH "MOVING THE CURSOR"
39 .PP
40 The cursor tells fdupes which file and/or set of duplicates to act on, as described in the next section. The cursor's position can be changed as follows:
41
42 .B 
43 .IP "DOWN"
44 Advance cursor to the next file on the list.
45
46 .B 
47 .IP "UP"
48 Move cursor back to the previous file.
49
50 .B 
51 .IP "TAB"
52 Advance cursor to the next set of duplicates.
53
54 .B 
55 .IP "BACKSPACE"
56 Move cursor back to the previous set.
57
58 .B
59 .IP "F3"
60 Advance cursor to the next
61 .I selected
62 set, if any.
63
64 .B
65 .IP "F2"
66 Move cursor back to the previous
67 .I selected
68 set, if any.
69
70 .PP
71 It is also possible to jump directly to a particular set:
72
73 .B
74 .IP "'goto <index>'"
75 Move cursor to the top of the set indicated by
76 .IR index .
77
78 .SH "TAGGING FILES USING THE CURSOR"
79 .PP
80 Individual files can be tagged using the keys below. These keys all act on the current file, as identified by the cursor.
81
82 .B 
83 .IP "SHIFT + RIGHT"
84 Tag current file for keeping.
85
86 .B 
87 .IP "SHIFT + LEFT"
88 Tag current file for deletion.
89
90 .B
91 .IP "'?'"
92 Remove tag from current file.
93
94 .PP
95 Entire sets of files can be tagged by providing a list of indices in a comma-separated list. Files in the current set whose indices appear on the list will be tagged for keeping, while any other files in that set will be tagged for deletion. As with individual files, the current set is identified by the cursor.
96
97 .PP
98 As an example, given the following list of duplicates:
99 .PP
100 .RS
101 .B
102 Set 1 of 5:
103
104   1 [ ] path/to/file_a
105   2 [ ] path/to/file_b
106   3 [ ] path/to/file_c
107 .RE
108
109 .PP
110 Typing
111 .B
112 \|'1, 3\|'
113 at the prompt and pressing ENTER will tell fdupes to tag
114 .I
115 file_a
116 and
117 .I
118 file_c
119 for keeping, and
120 .I
121 file_b
122 for deletion. The special command
123 .B
124 \|'all\|'
125 will tag all files for keeping.
126
127 .PP
128 There is one more command to deal with files in the current set:
129 .B
130 .IP "'rg'"
131 Remove tags from all files in current set.
132
133 .SH "FILE SELECTION COMMANDS"
134 .PP
135 Another way to tag files is to first select them according to particular search criteria and then tell fdupes what to do with them. The following commands can be used to select files for tagging:
136
137 .B
138 .IP "'sel <text>'"
139 Select any files whose paths contain the given text.
140
141 .B
142 .IP "'selb <text>'"
143 Select any files whose paths begin with the given text.
144
145 .B
146 .IP "'sele <text>'"
147 Select any files whose paths end with the given text.
148
149 .B
150 .IP "'selm <text>'"
151 Select any file whose path matches the given text exactly.
152
153 .B
154 .IP "'selr <expression>'"
155 Select any files whose paths match the given
156 .I
157 regular expression
158 (see below).
159
160 .B
161 .IP "'dsel <text>'"
162 Deselect any files whose paths contain the given text.
163
164 .B
165 .IP "'dselb <text>'"
166 Deselect any files whose paths begin with the given text.
167
168 .B
169 .IP "'dsele <text>'"
170 Deselect any files whose paths end with the given text.
171
172 .B
173 .IP "'dselm <text>'"
174 Deselect any file whose path matches the given text exactly.
175
176 .B
177 .IP "'dselr <expression>'"
178 Deselect any files whose paths match the given
179 .I
180 regular expression
181 (see below).
182
183 .B
184 .IP "'cs'"
185 Clear all selections.
186
187 .B
188 .IP "'igs'"
189 Invert selections within selected sets. For example, if files 1 and 4 in a set of 5 are selected,
190 .B
191 igs
192 will deselect files 1 and 4, and select files 2, 3, and 5. Immediately repeating the same command will deselect files 2, 3, and 5, and select files 1 and 4, restoring selections to their previous state.
193
194 .SH "TAGGING SELECTED FILES"
195 .PP
196 Once some files have been selected using the commands described above, the following commands can be used to tag selected files as desired:
197 .B
198 .IP "'ks'"
199 Tag selected files for keeping.
200
201 .B
202 .IP "'ds'"
203 Tag selected files for deletion.
204
205 .B
206 .IP "'rs'"
207 Remove all tags from selected files.
208
209 .SH "DELETING DUPLICATES"
210 Once they've been tagged for deletion, files can be deleted by pressing
211 .B
212 DELETE.
213 Fdupes will delete any files that are tagged for deletion and delist any sets whose remaining files have been tagged for keeping. For safety, fdupes will refuse to act on sets for which all files have been tagged for deletion. To handle these cases, tag at least one file for keeping and run the delete command again.
214
215 .SH "OTHER COMMANDS"
216 .B
217 .IP "'exit', 'quit'"
218 Exit the program.
219
220 .B
221 .IP "'help'"
222 Display this help text.
223
224 .SH "REGULAR EXPRESSIONS"
225 .PP
226 A regular expression is a sequence of characters defining a search pattern against which other character sequences can be compared. Strings of characters that follow the pattern defined by an expression are said to
227 .I
228 match
229 the expression, whereas strings that break the pattern do not.
230 .PP
231 The syntax for regular expressions used by fdupes is known as the
232 .B
233 Perl Compatible Regular Expression
234 syntax. A detailed description of regular expression syntax is beyond the scope of this document. For detailed information the user is encouraged to consult the
235 .I
236 PCRE2
237 documentation:
238 .PP
239 .RS
240 https://www.pcre.org/current/doc/html/pcre2syntax.html
241 .RE
242
243 .PP
244 Briefly, here are some examples of regular expressions:
245
246 .B
247 .IP "abc123"
248 Will match any string containing the sequence
249 .IR abc123 ,
250 such as
251 .IR abc123 ,
252 .IR abc123x ,
253 .IR xabc123 ,
254 and
255 .IR xabc123x .
256
257 .B
258 .IP "^abc123"
259 Will match any string beginning with
260 .IR abc123 ,
261 such as 
262 .IR abc123 " and " abc123x ,
263 but not
264 .IR xabc123 " or " xabc123x .
265 The character '^' has special meaning, telling the program to match only those strings that begin with the pattern that follows.
266
267 .B
268 .IP "abc123$"
269 Will match any string that ends with
270 .IR abc123 ,
271 such as
272 .IR abc123 " and " xabc123 ,
273 but not
274 .IR abc123x " or " xabc123x .
275 The character '$' has special meaning, telling the program to match only those strings that end with the preceding pattern.
276
277 .B
278 .IP "^abc123$"
279 Will match the string
280 .I abc123
281 and no other.
282
283 .B
284 .IP "ab.123"
285 Will match any string containing
286 .I abc123
287 as in the first example, but it will also match strings containing
288 .IR abz123 , 
289 .IR ab0123 , 
290 .IR ab_123 ,
291 etc. The character '.' has special meaning, acting as a placeholder that will match any character in that position.
292
293 .B
294 .IP "^a.*3$"
295 Will match any string beginning with the letter a and ending with the number 3, such as
296 .IR abc123 ,
297 .IR a3 ,
298 and
299 .IR a0b1c2d3 .
300 Here the character '*' tells the program to accept any number of appearances (including none) for the preceding item (here, any character matching the placeholder character '.'). The characters '^' and '$' have the same meaning as in previous examples.
301
302 .B
303 .IP "abc\ed+"
304 Will match any string containing the characters
305 .B abc
306 followed immediately by one or more decimal digits, such as
307 .IR abc123 " and " abc3210 ,
308 but not
309 .IR abcd123
310 or
311 .I "abc 123"
312 (note the space). Here \ed is a placeholder for any decimal digit, while the character '+' tells the program to match one or more appearances of the preceding character or placeholder (here, \ed).
313
314 .B
315 .IP "\ew+\ed+"
316 Will match any string containing one or more "word" characters followed immediately by one or more decimal digits, such as
317 .IR abc123 " and " abcd3210 ,
318 but not
319 .IR "abc 123"
320 (note the space). Here \ew is a placeholder for a "word" character, and \ed and '+' have the same meaning as in the preceding example.
321
322 .PP
323 This is just scratching the surface of what can be done with regular expressions. Consult the PCRE2 documentation for a complete reference.
324
325 .SH "SEE ALSO"
326 The fdupes man page,
327 .BR fdupes (1).