Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-05-2011, 09:34 PM   #1
LQ Newbie
Registered: Dec 2006
Posts: 13

Rep: Reputation: 0
Question [GNU find version 4.2.27] find: paths must precede expression

I have difficulties with the "find" command. Maybe I'm just not understanding really how to use it.

Let's say I am searching for all files with the extension "xsc":

[prompt]$ find ~ -name *.xsc 
Okay works. Now I want to search for all files ending with "xsc" and maybe followed by something else, this gives me this error message:

[prompt]$ find ~ -name *.xsc*
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]
Why does this not work?

I'm using
GNU find version 4.2.27
CentOS release 5 (Final)
Old 07-05-2011, 10:21 PM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,840

Rep: Reputation: 342Reputation: 342Reputation: 342Reputation: 342
Here's one explanation:
1 members found this post helpful.
Old 07-06-2011, 01:39 AM   #3
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2015, Slack14.1 DebJessie, + 50+ other Linux OS, for test only.
Posts: 15,636

Rep: Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991Reputation: 2991

find ~ -name *.xsc* : Use quotes → → find ~ -name "*.xsc*"
Old 07-06-2011, 05:34 AM   #4
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 715Reputation: 715Reputation: 715Reputation: 715Reputation: 715Reputation: 715Reputation: 715
knudfl's solution is correct.

What's happening it that bash is interpreting the wildcards (in your case, turning them into a list of all files matching "*.xsc*" in the current directory) before passing them to find.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
find: paths must precede expression lead2gold Linux - General 11 02-27-2014 07:06 AM
rsync and find - how do I get the paths right? dormant Linux - Software 2 05-31-2010 10:23 AM
find: paths must precede expression -- already checked google/man/faqs escalf Programming 5 03-02-2010 10:12 AM
Problem with find: paths must precede expression troelskn Programming 11 07-29-2009 02:48 AM
Algorithm to find paths xeon123 Programming 5 04-24-2007 02:18 AM

All times are GMT -5. The time now is 10:55 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration