Linux Find: by Permission

According to User

Below command is based on the current user.

find . -readable
find . -writable
find . -executable

According to File

Sample scenario is when to find any file that is at least executable by someone.

$ find . -perm /u=x,g=x,o=x
  • Prefix - = AND
  • Prefix / = OR

Negate the result

Unfortunately, to find non-executable file is not very straightforward.

$ find . -perm -u-x,g-x,o-x --> NOT WORKING
find . ! -perm -a=x,g=x,o=x -printf "%M %p\n"
! -a=x,g=x,o=x --> a!=x OR g!=x OR o!=x
! /a=x,g=x,o=x --> a!=x AND g!=x AND o!=x

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store