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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like