I'm trying to find all the setuid/setgid binaries on my system. I've found two different ways to do this online.

What's the difference between

find / -perm +6000 -type f

and

find / -perm /6000 -type f

?

The latter is mentioned more often, and their results are the same. I want to make absolutely sure I don't miss any files. Are they the same?

I'm running this on an Ubuntu trusty box, but that could change in the future.

The find manual page explains:

   -perm +mode
          Deprecated,  old way of searching for files with any of the per‐
          mission bits in mode set.  You should use -perm  /mode  instead.
          Trying to use the `+' syntax with symbolic modes will yield sur‐
          prising results. […]

So yes, they're the same thing, but you should use -perm /mode.

The man page for GNU find says:

-perm /mode
  Any of the permission bits mode are set for the file.
  ...

and

-perm +mode
  Deprecated, old way of searching for files with any of the permission bits in  mode  set.
  You should use -perm /mode instead. Trying to use the ‘+’ syntax with symbolic modes will
  yield surprising results.
  ...

and gives some examples of what those surprising results would be. So, they're equivalent, except that sometimes +mode can't be used and /mode can, so +mode should be avoided where /mode is supported.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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