Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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
share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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