Imported Upstream version 2.1.2
[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 "'csel'"
185 Clear all selections.
186
187 .B
188 .IP "'isel'"
189 Invert selections within selected sets. For example, if files 1 and 4 in a set of 5 are selected,
190 .B
191 isel
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 tagged for deletion, files can be deleted by pressing
211 .B
212 DELETE
213 or using the
214 .B 'prune'
215 command. 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.
216
217 .SH "OTHER COMMANDS"
218 .B
219 .IP "'exit', 'quit'"
220 Exit the program.
221
222 .B
223 .IP "'help'"
224 Display this help text.
225
226 .SH "REGULAR EXPRESSIONS"
227 .PP
228 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
229 .I
230 match
231 the expression, whereas strings that break the pattern do not.
232 .PP
233 The syntax for regular expressions used by fdupes is known as the
234 .B
235 Perl Compatible Regular Expression
236 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
237 .I
238 PCRE2
239 documentation:
240 .PP
241 .RS
242 https://www.pcre.org/current/doc/html/pcre2syntax.html
243 .RE
244
245 .PP
246 Briefly, here are some examples of regular expressions:
247
248 .B
249 .IP "abc123"
250 Will match any string containing the sequence
251 .IR abc123 ,
252 such as
253 .IR abc123 ,
254 .IR abc123x ,
255 .IR xabc123 ,
256 and
257 .IR xabc123x .
258
259 .B
260 .IP "^abc123"
261 Will match any string beginning with
262 .IR abc123 ,
263 such as 
264 .IR abc123 " and " abc123x ,
265 but not
266 .IR xabc123 " or " xabc123x .
267 The character '^' has special meaning, telling the program to match only those strings that begin with the pattern that follows.
268
269 .B
270 .IP "abc123$"
271 Will match any string that ends with
272 .IR abc123 ,
273 such as
274 .IR abc123 " and " xabc123 ,
275 but not
276 .IR abc123x " or " xabc123x .
277 The character '$' has special meaning, telling the program to match only those strings that end with the preceding pattern.
278
279 .B
280 .IP "^abc123$"
281 Will match the string
282 .I abc123
283 and no other.
284
285 .B
286 .IP "ab.123"
287 Will match any string containing
288 .I abc123
289 as in the first example, but it will also match strings containing
290 .IR abz123 , 
291 .IR ab0123 , 
292 .IR ab_123 ,
293 etc. The character '.' has special meaning, acting as a placeholder that will match any character in that position.
294
295 .B
296 .IP "^a.*3$"
297 Will match any string beginning with the letter a and ending with the number 3, such as
298 .IR abc123 ,
299 .IR a3 ,
300 and
301 .IR a0b1c2d3 .
302 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.
303
304 .B
305 .IP "abc\ed+"
306 Will match any string containing the characters
307 .B abc
308 followed immediately by one or more decimal digits, such as
309 .IR abc123 " and " abc3210 ,
310 but not
311 .IR abcd123
312 or
313 .I "abc 123"
314 (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).
315
316 .B
317 .IP "\ew+\ed+"
318 Will match any string containing one or more "word" characters followed immediately by one or more decimal digits, such as
319 .IR abc123 " and " abcd3210 ,
320 but not
321 .IR "abc 123"
322 (note the space). Here \ew is a placeholder for a "word" character, and \ed and '+' have the same meaning as in the preceding example.
323
324 .PP
325 This is just scratching the surface of what can be done with regular expressions. Consult the PCRE2 documentation for a complete reference.
326
327 .SH "SEE ALSO"
328 The fdupes man page,
329 .BR fdupes (1).