Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm doing a search for files that contain ".anki" in their file name.

root@t500:/home/some1# find / -name .anki
/home/some1/.anki

But there are other files in my home folder that contain .anki:

all-feb-18-2013.anki
all-mar-10-2013.anki
all-oct-06-2012.anki

Why don't those appear with my search?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

find's -name predicate accepts shell-like globbing patterns. These patterns are anchored to the starts and ends of lines. Try this instead:

find / -name '*.anki'

The * is a wildcard. It will match zero or more characters. Without it, find will search for files named .anki. Be sure to quote the *. If you don't, the shell will expand it.

You can also use regular expressions with some variants of find.

find / -regex '.*\.anki'

See the find(1) manpage for more information.

share|improve this answer
    
Why doesn't it work with what I used.. is it looking for exact matches only in my version? –  some1 Jul 27 '13 at 21:49
    
@some1: Your version is looking for exact matches. I've updated my question a bit. –  paraxor Jul 27 '13 at 21:51

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.