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

So I know how to find strings in a filename that are at the end or the beginning of the line using the asterisk character accordingly. Problem is I can't find a way to find a string anywhere in the filename. So while a command like this:

find -name foo

will only match a file named foo and ones using the asterisk will only match ones at the end or beginning of the filename, I want an expression that will find "foo" in a filename like "foobar".

share|improve this question

asterisk before and after foo:

find . -name "*foo*"
share|improve this answer
    
you are a true guru :) – Ярослав Рахматуллин Oct 26 '12 at 20:06

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.