How to find executable filetypes?
Later edit: only this one does what jan needs: thank you huygens;
find . -exec file {} \; | grep -i elf
Like others, I want to answer too. My answer is based on using the find
utility too, but I have an idea, which is differ against other answers. It grounded on that fact, that the -exec
can be used as the search criteria too. Now, having this thing in mind, we can refactor all of the previous proposals to this one:
find /path -type f -exec sh -c "file {} | grep -Pi ': elf (32|64)-bit' > /dev/null" \; -print
I.e. we have moved the grep
into the -exec
.
What does this give to us, you may ask? We can use the flexibility of the -print
and others of the find
utility. For example, we can format an output on our taste, or use the -print0
and redirect an output to some script etc.