find out all executables and shared libs in a directory

Q: How to find all executable binaries and shared libs in a directory?
Q: How to find binary executables within a directory?
Q: How to find out all the binaries and executables with in a directory that is not stripped?

Executable binaries:
$ find -type f -executable -exec file -i ‘{}’ \; | grep ‘x-executable; charset=binary’ | cut -d : -f 1
$ find -type f -executable -exec sh -c “file -i ‘{}’ | grep -q ‘x-executable; charset=binary'” \; -print

Shared libs:
$ find -type f -executable -exec file -i ‘{}’ \; | grep ‘application/x-sharedlib; charset=binary’ | cut -d : -f 1
$ find -type f -executable -exec sh -c “file -i ‘{}’ | grep -q ‘application/x-sharedlib; charset=binary'” \; -print

all not stripped:
$ find . -exec file {} \; | grep -i ‘not stripped’

Leave a Reply

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

15 − five =