What Is the “-O” Argument in Find Command?

I am currently running this command:

find . \( -type d -name .git -prune \) -o -type f -name "*"` on my macos shell.

I found the command in a Stack Overflow thread for another problem. I do not understand what -o argument is for.

I have looked into find’s man page and searched the web but could not find what is the argument for.

1 Answer

That -o means “or”.

As explained in the find man page:

The POSIX standard specifies parentheses '(', ')', negation '!' and the 'and' and 'or' operators ( -a, -o).

So -o is “or” and -a is and. Simple as that!

And FWIW, this ExplainShell page breaks down the whole command (somewhat) clearly.

Your Answer

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

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest