LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
LinkBack Search this Thread
Old 07-05-2011, 09:34 PM   #1
mechagojira
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":

Code:
[prompt]$ find ~ -name *.xsc 
/home/mechagojira/project/foobar.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:

Code:
[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
on
CentOS release 5 (Final)
 
Old 07-05-2011, 10:21 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,696

Rep: Reputation: 286Reputation: 286Reputation: 286
Here's one explanation: http://www.programmersheaven.com/use...de-expression/
 
1 members found this post helpful.
Old 07-06-2011, 01:39 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2013.07, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,196

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
*


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

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
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.
 
  


Reply

Tags
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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 01:29 AM.

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