From https://unix.stackexchange.com/a/277707/674

find . ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD

can find duplicate files under the current directory.

What does -dD mean to uniq? I saw the meanings of -d and -D in manpage, but not sure what they mean when they are used together. Thanks.


TLDR Bottom line, they do nothing when used together; -dD is identical to -D.


If you look at the case/switch logic of the uniq.c command you can see this first hand:

case 'd':
  output_unique = false;
  output_option_used = true;

case 'D':
  output_unique = false;
  output_later_repeated = true;
  if (optarg == NULL)
    delimit_groups = DM_NONE;
    delimit_groups = XARGMATCH ("--all-repeated", optarg,
  output_option_used = true;

The way that this code is structured, if either -dD is set, ouput_unique is set to false; but more importantly, output_later_repeated is set to true.

Once that condition is set, output_later_repeated, there's no feasible way for -dD to have anything but identical output to -D.

Incidentally, the computerhope man page has a better table that explains the -d and -D switches.



The uniq -dD makes no sense - it's equivalent of uniq -D. Both -dD and -D will produce always same result since -d's output set is a subset of -D.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.