The following command works on Ubuntu (GNU findutils 4.4.2) but not on Fedora (4.2.27)
time find . -maxdepth 1 -type f -executable -print
How do I find executable files using older version of find?
find . -maxdepth 1 -type f -perm /a+x
From the man:
-perm /mode
Any of the permission bits mode are set for the file. Symbolic modes are accepted in this form. You must specify ’u’, ’g’ or ’o’ if you use a symbolic mode. See the EXAMPLES section for some illustrative examples. If no permission bits in mode are set, this test currently matches no files. However, it will soon be changed to match any file (the idea is to be more consistent with the behaviour of perm -000).
The EXAMPLES section has something where the find
shows all writable files. A find
on executable files will be similar to the given example.
find . | file -f - | grep executable
might be much slower, but also will look for things that are executables, but not necessarily permissioned as such. You may need to change what you grep for to improve accuracy (this would also match a file called "executable.jpg") narrow results (you may only be looking for a certain type of exe) and you might want to prettify the output later.
Really would be useful to know why you are doing this in order to construct the best answer :)