Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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