Visit Jeremy's Blog.
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 01-15-2015, 02:05 PM   #1
Registered: Feb 2012
Distribution: ubuntu
Posts: 44

Rep: Reputation: Disabled
find command fear and loathing

Its plentiful documentation fails to explain how to use it. After googling all over the world and hunting down examples, it turns out they don't work as the man page indicates if you alter them in the slightest. In fact I know what I want to find, where it is, how to describe it; but the problem is getting find to list that file or those files and moreover making sense of its horrid documentation. It lists too many things. It ignores -prune. It either does nothing or too much. Its a horrible, horrible program, and you are expected to make up the difference by experimentation.

Its so complicated as to make it more worthwhile just to list every file and filter them out with other utilities. Honestly, why go through so much trouble to learn about a command that is as obfuscated as a heartpump?

Sure its great for listing all the files and directories in one subdir, but if you want to exclude multiple dirs or files forget it. Pipe it through grep.
Old 01-16-2015, 07:48 AM   #2
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Old 01-16-2015, 08:21 AM   #3
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,720

Rep: Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887
Yů're right. I find the -path option broken - sad but true.

Use it this way:
From search top dir <find -name '*name*'> and both asterisks may not be necessary
For case insensitive <find -iname '*name*'>

or for file type
<find -type l' all the types work.

The atime & ctime also leave me desiring accommodation in a home for the bewildered. Continuing the good tradition of pppd, vim, emacs and such worth candidates for a total rewrite.
Old 01-16-2015, 08:53 AM   #4
J Martin Rushton
Registered: Jan 2015
Location: England
Distribution: Mainly CentOS
Posts: 31

Rep: Reputation: Disabled
Running on CentOS 6:
# find /usr -path find
# find /usr -path \*find
which is exactly as documented.

# find /usr/* -prune
These are all directories (except tmp which is a link), so find does not descend into them, exactly as documented.

-{a,c,m}time can be a bit of fun, consider using -daystart to force the interpretation of time to run from 00:00:00 today. -daystart -mtime +1 is then always earlier than yesterday.

As regards to listing all files and filtering them, find will be more efficient and do it with less image activations. Not a problem for a few hundred files, but significant for a few hundred thousand.

Like many venerable programs the syntax can be a bit funny, but then it tries to accommodate various historic flavours of UNIX as well as modern Linux systems. ps is another fundamental program that suffers from the same option bloat. In practice I find you end up knowing the half dozen or so options you use and ignoring the rest until you stumble across them in a script.
1 members found this post helpful.


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
LXer: Fear & Loathing At 3 AM LXer Syndicated Linux News 0 12-16-2014 03:12 PM
LXer: Fear and loathing in Holland LXer Syndicated Linux News 0 03-15-2009 06:40 AM
fear and loathing with solaris fancylad Solaris / OpenSolaris 23 06-04-2008 04:28 PM
Apple is Worried? (Fear and Loathing in Cupertino) rickh General 3 05-18-2007 06:51 PM
LXer: Fear And Loathing In Googlemania LXer Syndicated Linux News 0 04-27-2006 05:54 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:39 AM.

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