This is a good tutorial, but...

Story: Finding Files On The Command LineTotal Replies: 7
Author Content
caitlyn

Sep 02, 2009
10:08 AM EDT
This is a good tutorial. Find is an extremely valuable tool.

The "but" refers to the first introductory paragraph only. Nowadays the author, probably correctly, assumes that the typical Linux user will know a bunch of GUI tools and file managers but have no clue on the command line. Find is UNIX 101. It's an absolute basic. Yet it's assumed to be an unknown while nautilus and konqueror are assumed to be known quantities.

How the Linux community has changed in the past decade or so...
gus3

Sep 02, 2009
11:30 AM EDT
$ locate filename-fragment | grep username

A lot faster, no anti-globbing measures required, and it requires less disk I/O and fewer seeks. It's also not as flexible as "find", but if you're just wanting to find a file, the KISS principle works very well.
azerthoth

Sep 02, 2009
11:57 AM EDT
I find (no pun) that I use locate more as well, with the mlocate backend. locate foo and toss in | grep is fine tuning is needed. On large systems I can run locate many times in the time frame it takes on $ find -name foo / .
hkwint

Sep 02, 2009
2:00 PM EDT
I use my home brewn '/usr/local/bin/where' a lot. It looks for a part of a file name recursively (doh!) in the current dir.

#!/bin/bash [ -z $1 ] && echo "No argements given" && exit /usr/bin/find . -iname "*$1*"

Sure, slocate is quicker, but not always up to date. And -exec when combined to "find" is great, especially when you have to delete lots of certain files. For example when you wrote an id3tag-script that fails miserably due to id3tag creating new files whenever it has files as arguments that don't exist (because you didn't carefully escape the spaces in the song names!)
Steven_Rosenber

Sep 02, 2009
7:21 PM EDT
You know, commands I don't use a lot, I forget. And both find and locate are ones I just never became accustomed to using. So I appreciate this kind of tutorial even though I'm not console-phobic.

In a related matter, I have the second edition of this book, which can probably be obtained used very, very cheaply. The new edition isn't expensive either. It's a great command-line resource:

http://www.amazon.com/Unix-Linux-Visual-QuickStart-Guide/dp/...
caitlyn

Sep 02, 2009
7:49 PM EDT
For a system command reference I like:

http://www.amazon.com/Linux-System-Commands-Patrick-Volkerdi...

I've had it on my bookshelf for a long time and it, as a reference book, is as good as it gets. Some here probably have a bias in favor of one of the authors :)
jdixon

Sep 02, 2009
11:08 PM EDT
> Some here probably have a bias in favor of one of the authors :)

Possibly. :)
gus3

Sep 03, 2009
12:50 AM EDT
Having met the man....

Yeah.

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!