fdupes-help - Man Page
fdupes interactive mode reference
When run interactively (as fdupes --delete), fdupes will show a list of duplicates and prompt the user for further action.
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.
There are several ways to tag files in fdupes: individually using the cursor, 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.
Scrolling the List
The list of duplicates can be scrolled as follows:
- PAGE DOWN
Scroll down to the next page.
- PAGE UP
Scroll up to preceding page.
- SHIFT + DOWN
Scroll down by one line. Not supported on some terminals.
- SHIFT + UP
Scroll up by one line. Not supported on some terminals.
Moving the Cursor
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:
Advance cursor to the next file on the list.
Move cursor back to the previous file.
Advance cursor to the next set of duplicates.
Move cursor back to the previous set.
Advance cursor to the next selected set, if any.
Move cursor back to the previous selected set, if any.
It is also possible to jump directly to a particular set:
- 'goto <index>'
Move cursor to the top of the set indicated by index.
Tagging Files Using the Cursor
Individual files can be tagged using the keys below. These keys all act on the current file, as identified by the cursor.
- SHIFT + RIGHT
Tag current file for keeping.
- SHIFT + LEFT
Tag current file for deletion.
Remove tag from current file.
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.
As an example, given the following list of duplicates:
Set 1 of 5:
1 [ ] path/to/file_a
2 [ ] path/to/file_b
3 [ ] path/to/file_c
Typing '1, 3' at the prompt and pressing ENTER will tell fdupes to tag file_a and file_c for keeping, and file_b for deletion. The special command 'all' will tag all files for keeping.
There is one more command to deal with files in the current set:
Remove tags from all files in current set.
File Selection Commands
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:
- 'sel <text>'
Select any files whose paths contain the given text.
- 'selb <text>'
Select any files whose paths begin with the given text.
- 'sele <text>'
Select any files whose paths end with the given text.
- 'selm <text>'
Select any file whose path matches the given text exactly.
- 'selr <expression>'
Select any files whose paths match the given regular expression (see below).
- 'dsel <text>'
Deselect any files whose paths contain the given text.
- 'dselb <text>'
Deselect any files whose paths begin with the given text.
- 'dsele <text>'
Deselect any files whose paths end with the given text.
- 'dselm <text>'
Deselect any file whose path matches the given text exactly.
- 'dselr <expression>'
Deselect any files whose paths match the given regular expression (see below).
Clear all selections.
Invert selections within selected sets. For example, if files 1 and 4 in a set of 5 are selected, isel 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.
Tagging Selected Files
Once some files have been selected using the commands described above, the following commands can be used to tag selected files as desired:
Tag selected files for keeping.
Tag selected files for deletion.
Remove all tags from selected files.
Once tagged for deletion, files can be deleted by pressing DELETE or using the 'prune' 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.
- 'exit', 'quit'
Exit the program.
Display this help text.
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 match the expression, whereas strings that break the pattern do not.
The syntax for regular expressions used by fdupes is known as the Perl Compatible Regular Expression 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 PCRE2 documentation:
Briefly, here are some examples of regular expressions:
Will match any string containing the sequence abc123, such as abc123, abc123x, xabc123, and xabc123x.
Will match any string beginning with abc123, such as abc123 and abc123x, but not xabc123 or xabc123x. The character '^' has special meaning, telling the program to match only those strings that begin with the pattern that follows.
Will match any string that ends with abc123, such as abc123 and xabc123, but not abc123x or xabc123x. The character '$' has special meaning, telling the program to match only those strings that end with the preceding pattern.
Will match the string abc123 and no other.
Will match any string containing abc123 as in the first example, but it will also match strings containing abz123, ab0123, ab_123, etc. The character '.' has special meaning, acting as a placeholder that will match any character in that position.
Will match any string beginning with the letter a and ending with the number 3, such as abc123, a3, and a0b1c2d3. 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.
Will match any string containing the characters abc followed immediately by one or more decimal digits, such as abc123 and abc3210, but not abcd123 or abc 123 (note the space). Here \d 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, \d).
Will match any string containing one or more "word" characters followed immediately by one or more decimal digits, such as abc123 and abcd3210, but not abc 123 (note the space). Here \w is a placeholder for a "word" character, and \d and '+' have the same meaning as in the preceding example.
This is just scratching the surface of what can be done with regular expressions. Consult the PCRE2 documentation for a complete reference.
The fdupes man page, fdupes(1).