FDUPES-HELP(7)

πŸ’– NAME πŸ’–

fdupes-help β€” the fdupes interactive mode reference, bestie. This is FDUPES-HELP(7) from the Miscellaneous Information Manual, and it's literally your group chat with fdupes when you run it in interactive mode. πŸ¦‹


✨ INTRODUCTION ✨

So the way this works: when you run it interactively (as fdupes --delete), fdupes shows you a whole list of duplicates and then prompts you for what to do next. Main character energy. πŸ‘‘

You tell fdupes which files to keep or delete by tagging them accordingly. Once stuff is tagged, you can tell fdupes to delete anything that's been tagged for deletion. And here's the cute part β€” you can do it incrementally if you want! Tag a few, delete a few, tag some more, delete some more, over and over until there are no more duplicates left to deal with. Little bites. Snackable. πŸ“

There are several ways to tag files in fdupes:

  • individually, using the cursor
  • by handing it a list of files to keep
  • by selecting files that match particular search criteria and tagging those however you like

Each one gets its own little section below. No skipping. πŸ’…


🌈 SCROLLING THE LIST 🌈

You can scroll the list of duplicates like this:

  • PAGE DOWN β€” scroll down to the next page.
  • PAGE UP β€” scroll up to the preceding page.
  • SHIFT + DOWN β€” scroll down by one line.
  • SHIFT + UP β€” scroll up by one line.
Heads up bestie: SHIFT + DOWN and SHIFT + UP are not supported on some terminals. So if nothing happens, it's not you, it's the terminal. 😭

πŸŽ€ MOVING THE CURSOR πŸŽ€

The cursor is the little vibe-check pointer that tells fdupes which file and/or set of duplicates you're acting on (more on that in the next section). You move it like this:

  • DOWN β€” advance the cursor to the next file on the list.
  • UP β€” move the cursor back to the previous file.
  • TAB β€” advance the cursor to the next set of duplicates.
  • BACKSPACE β€” move the cursor back to the previous set.
  • F3 β€” advance the cursor to the next selected set, if any.
  • F2 β€” move the cursor back to the previous selected set, if any.

You can also jump straight to a particular set, no scrolling required:

  • goto <index> β€” move the cursor to the top of the set indicated by index.

🌸 TAGGING FILES USING THE CURSOR 🌸

You can tag individual files with the keys below. Every single one of these acts on the current file β€” the one your cursor is sitting on.

  • SHIFT + RIGHT β€” tag the current file for keeping.
  • SHIFT + LEFT β€” tag the current file for deletion.
  • ? β€” remove the tag from the current file.

You can also tag entire sets of files by handing fdupes a comma-separated list of indices. Files in the current set whose indices show up on that list get tagged for keeping, and every other file in that set gets tagged for deletion. Same as with individual files: the current set is the one your cursor is on.

Example time, because examples slay. Say your list of duplicates looks like this:

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 tells fdupes to tag file_a and file_c for keeping, and file_b for deletion. And there's a special command β€” all β€” which tags all the files for keeping. πŸ‘‘

There's one more command for dealing with files in the current set:

  • rg β€” remove tags from all files in the current set.

πŸ¦‹ FILE SELECTION COMMANDS πŸ¦‹

Another way to tag files: first select them according to particular search criteria, then tell fdupes what to do with them. These commands do the selecting:

  • 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).
  • csel β€” clear all selections.
  • isel β€” invert selections within selected sets.

Ok so about isel, because it's lowkey the fun one. 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. And then if you immediately repeat the exact same command, it deselects files 2, 3, and 5 and selects files 1 and 4 again β€” restoring your selections to exactly what they were before. A flip. A little toggle. ✨


πŸ’… TAGGING SELECTED FILES πŸ’…

Once you've selected some files with the commands above, these are the ones that tell fdupes what to do with your selection:

  • ks β€” tag selected files for keeping.
  • ds β€” tag selected files for deletion.
  • rs β€” remove all tags from selected files.

πŸ”₯ DELETING DUPLICATES πŸ”₯

Once things are tagged for deletion, you delete them by pressing DELETE or by using the prune command. Fdupes will delete any files tagged for deletion, and it'll delist any sets whose remaining files have been tagged for keeping. So clean. So satisfying.

⚠️ But for safety, fdupes will refuse to act on sets where all the files have been tagged for deletion. If you hit one of those, tag at least one file for keeping and run the delete command again. No accidental nuking in this house. πŸ›‘

πŸ’œ OTHER COMMANDS πŸ’œ

  • exit, quit β€” exit the program. Bye bestie! 🫢
  • help β€” display this help text. (Hi, that's this. You're here.)

⭐ REGULAR EXPRESSIONS ⭐

Okay so a regular expression is a sequence of characters that defines a search pattern, and you compare other character sequences against it. Strings that follow the pattern the expression defines are said to match the expression. Strings that break the pattern do not. That's it. That's the whole concept.

The syntax fdupes uses for regular expressions is known as the Perl Compatible Regular Expression syntax. A detailed description of regular expression syntax is beyond the scope of this document, so if you want the full tea, the user is encouraged to consult the PCRE2 documentation:

https://www.pcre.org/current/doc/html/pcre2syntax.html

But briefly β€” here are some examples of regular expressions:

  • abc123 β€” will match any string containing the sequence abc123, such as abc123, abc123x, xabc123, and xabc123x.
  • ^abc123 β€” will match any string beginning with abc123, such as abc123 and abc123x, but not xabc123 or xabc123x. The character ^ has special meaning here β€” it tells the program to match only those strings that begin with the pattern that follows.
  • abc123$ β€” will match any string that ends with abc123, such as abc123 and xabc123, but not abc123x or xabc123x. The character $ has special meaning β€” it tells the program to match only those strings that end with the preceding pattern.
  • ^abc123$ β€” will match the string abc123 and no other. One and only one. Exclusive. πŸ’…
  • ab.123 β€” 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.
  • ^a.*3$ β€” 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 the previous examples.
  • abc\d+ β€” 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).
  • \w+\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.

And honestly? This is just scratching the surface of what you can do with regular expressions. Consult the PCRE2 documentation for a complete reference. πŸ”₯


🫢 SEE ALSO 🫢

The fdupes man page, fdupes(1).


And that's the whole page, bestie! This was fdupes-help, page FDUPES-HELP(7) from the Miscellaneous Information Manual. Go forth and delete your duplicates responsibly. πŸ’–βœ¨πŸŽ€πŸ¦‹