Here's a way to exclude scripts, i.e., files whose first two characters are #!
:
find -type f -executable -exec sh -c 'test "$(head -c 2 "$1")" != "#!"' sh {} \; -print
For some kinds of files, it's not clear whether you want them classified as scripts or binary, for example bytecode files. Depending on how things are set up, these may or may not start with #!
. If these matter to you, you'll have to make the inner shell script more complex. For example, here's how you might include ELF binaries and Mono executables and Objective Caml bytecode programs but not other kinds of executables like shell scripts or perl scripts or JVM bytecode programs:
find -type f -executable -exec sh -c '
case "$(head -n 1 "$1")" in
?ELF*) exit 0;;
MZ*) exit 0;;
#!*/ocamlrun*) exit 0;;
esac
exit 1
' sh {} \; -print