Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GNU find all executable files: Equivalent on OS X? [closed]

Tags:

find

macos

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
like image 287
alexgolec Avatar asked Aug 25 '12 04:08

alexgolec


People also ask

How do I find all EXE files?

-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."

How do I find EXE files on Mac?

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.

What is the .EXE equivalent in Linux?

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.

Which command will list all files that ends with EXE?

dir /s /b *.exe | findstr /v .exe. Save this answer.


3 Answers

You can use the perm operator:

find . -perm +0111 -type f
like image 94
nneonneo Avatar answered Nov 17 '22 12:11

nneonneo


You can also use mdfind:

mdfind "kMDItemKind == 'Unix Executable File'"
like image 26
Daniel Hawkins Avatar answered Nov 17 '22 14:11

Daniel Hawkins


Or you can just install the GNU findutils from Homebrew and use gfind instead of find.

like image 2
archpollux Avatar answered Nov 17 '22 13:11

archpollux