Skip to content

zsh – How to remove all Mach-O executables in a directory via Terminal?

Spread the love

Let’s say I put all my C codes and the executables in ~/anta40/Codes/C.

Removing all the C codes via Terminal is easy:

rm *.c

My question is how to remove all Mach-O executables (from compiling the C codes). On Windows this is very easy, because executables usually have exe extension, so you simply do:

del *.exe

I think this is trickier on MacOS because the executables typically don’t have specific extension. file may be useful, e.g:

$ file sortdemo
sortdemo: Mach-O 64-bit executable x86_64

No idea about the rest.

Leave a Reply

Your email address will not be published. Required fields are marked *