Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This is probably not a Ubuntu question as such, but a Linux one instead, still hope some Linux user out there can help me understand this.

I'm trying to use the find command to look for some files an a directory tree.

Unfortunately some of the files are named beginning with a dash, like -000.jpg, -002.jpg, 00n.jpg and so on. However, every time that the command locates one of the files named that way, it just interrupts the process and complains in the following way:

find: unknown predicate `-001.jpg'

or whatever the file beginning with a dash is named.

It seems to me that somehow the find command is interpreting the resulting filename as an argument, but I haven't found a way to circumvent this behavior.

Thanks in advance for sharing your wisdom.

share|improve this question
This is strange behavior and probably a bug...but I wonder if what's going on is that you have an expression with wildcards in your find command itself that is being expanded by the shell into filenames starting with - (before it is given to find). Can you edit your question to add the full and exact text of the find command you're issuing, which is producing this problem? –  Eliah Kagan May 25 '12 at 19:02
What is the exact command line you are using? –  Florian Diesch May 25 '12 at 19:34

1 Answer 1

up vote 6 down vote accepted

Make sure you quote the patterns you provide to find, otherwise the shell may expand them if there are matching files in the current dir.

find /some/dir -name *.jpg   # bad
find /some/dir -name "*.jpg" # good

See http://mywiki.wooledge.org/UsingFind.

share|improve this answer

Your Answer


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.