I need to get a list of all things marked as executable on a filesystem. On linux, I would just do:
find . -executable -type f
But on OS X, find complains:
find: -executable: unknown primary or operator
-type f -perm -u=x is not the equivalent of -executable : -executable matches all files that user can execute, and these include g+x if I'm in the proper group or o+x . Actually -perm -u=x will find lots of files that user can't execute, and miss a few that user can execute."
On MAC (OS X) you can do: Locate the application in Finder. Right-click the application and select "Show Package Contents." Locate the executable file: Typically, this is in Contents → MacOS, and has the same name as the application.
The standard Linux executable format is named Executable and Linking Format ( ELF). It was developed by Unix System Laboratories and is now the most widely used format in the Unix world.
dir /s /b *.exe | findstr /v .exe. Save this answer.
You can use the perm
operator:
find . -perm +0111 -type f
You can also use mdfind:
mdfind "kMDItemKind == 'Unix Executable File'"
Or you can just install the GNU findutils from Homebrew and use gfind instead of find.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With