Super User is a question and answer site for computer enthusiasts and power users. 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 am trying to find all my GRAPHML files under the current directory in bash. So I ran the following command:

find . -name *.graphml

And I get the error message:

find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]

What is wrong with the command above? The strange thing is that it works fine for other regexps.

share|improve this question
up vote 2 down vote accepted

Always enclose the pattern in quotes (e.g. *.graphml in your case). Otherwise it will be expanded by the shell before the find command. This means that find does not get a literal *graphml passed, but rather what the shell expands *.graphml to.


find . -name "*.graphml*"


  • man find which says: "Don't forget to enclose the pattern in quotes in order to protect it from expansion by the shell."
  • A little more about Quoting from the Advanced Bash Scripting Guide.
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .