Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 want show all the files that have a .bak extension.

kaykav@ubu2:~/Documents$ ls
cdIndex1-60  met.bak  tem.bak

I type the cmd : $ find . -name *.bak

I'm in the correct Directory for this. I get the following message:

find: paths must precede expression: tem.bak

What does that mean? Man pages are no help.

share|improve this question

Try putting it in quotes:

find . -name '*.bak'

When you simply use find . -name *.bak in that directory shell expands it to find . -name tem.bak met.bak (i.e. interprets * as the wildcard)

share|improve this answer
thank you for your reply. I'm not sure I comprehend the answer but it works. I thought *.bak means 'all' results that have a .bak ending. – kaykav Jul 9 '12 at 0:44
@kaykav When you run find . -name *.bak, the third command-line argument, *.bak, is expanded by the shell before it is passed to find. Shell expansion will convert it to a space-delimited list of all the filenames in the current directory that match it, i.e., all the files whose names consist of zero or more characters (*) followed by .bak. When you enclose *.bak in quotes, that escapes the * wildcard, so the expression is passed unexpanded. You could alternatively use find . -name \*.bak. – Eliah Kagan Jul 9 '12 at 3:19

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.