I've wondered recently if there is any way to look for archives|pics|media in Linux dirs? I can do it using the find command like this:

find ./ -iname "*.tar" 

or

find ./ -regex ".*\(jpg\|tar\|avi\)$"

But what if the needed file doesn't have an extension? How do I search for it? Any ideas?

link|improve this question
feedback

1 Answer

up vote 3 down vote accepted

You can use find + file:

For example, if you are looking for ASCII text, regardless of extension:

find -exec file {} \; | grep ASCII
link|improve this answer
1  
slightly optimize version: find -type f -exec file {} \; | grep ASCII – Sachin Divekar Nov 23 '11 at 14:58
very nice, didn't know that, thanks! – openme1984 Nov 23 '11 at 15:05
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.