I would look for regular files first as binary executable are belonging to that type of files.
Then I would request for each regular file the mime type and if it matches application/x-executable then it is a binary executable files (that should match Linux executable files, Windows one for instance match application/x-dosexec).
find . -type f -print0 | xargs -0 -n 10 file -i | grep "application/x-executable"
Trying this command I found a discrepency with find . -type f -print0 | xargs -0 -n 10 file | grep -w ELF. It seems that the command file is buggy and detects ELF executable as ELF shared object. So even though the command is theoricaly correct, in practice it is incomplete.
So we have to look for ELF executables and shared objects but exclude all files with a name of *.so and .so.
find . -type f ! \( -name "*.so.*" -o -name "*.so" \) -print0 | xargs -0 -n 10 file -i | egrep "application\/x-sharedlib|application\/x-executable"
It is not probably perfect, but that's the pretty close.
binfmt_miscyou can run arbitrary files like classes, exes etc. en.wikipedia.org/wiki/Binfmt_misc – Ulrich Dangel Jun 5 '12 at 15:35binfmt_misc. Binary formats are as flexible as filesystems on Linux. By all means, find ELFs, but (a) you're not finding all executable files, (b) the ELFs you find aren't necessarily executable in practice. For instance, a SPARC64 ELF won't run on an x86. – Alexios Jun 5 '12 at 16:25