Using the find command is there a way to combine options:


find . -type fd -name "somefile"

Although -type ignores the second option; I'm looking to find only files or directories.

  • Note that f is for regular files, not files (other types are files as well). – Stéphane Chazelas Jan 18 '14 at 9:15

You cannot combine characters after -type (unless you have a different find than I have). You have to do something like:

 find .  \( -type f -o -type d \) -name "somefile"

On my system:

 $ find .  -type fd -name "somefile"
 find: Arguments to -type should contain only one letter

That messages comes from the function insert_type() at line 2601 in findutils-4.4.2 find/parser.c. It just takes the first character, older/other versions of find did IIRC not even warn if there were multiple characters after -type.

  • do you know why the find command in particular doesn't allow the combining of options? – Ned Schneebly Jan 25 '14 at 4:48
  • @NedSchneebly fd would be the combination of an argument to option -type not an option itself. It is just programmed that way find's option handling with single dashes but long option names is IMHO strange anyway. I'll update the question. – Timo Jan 26 '14 at 15:03

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.