View previous topic :: View next topic |
Author |
Message |
Ben2040 Guru
Joined: 07 May 2003 Posts: 445 Location: UK
|
Posted: Thu Jun 12, 2003 6:02 am Post subject: Which find command is best? |
|
|
Hi
(I hope this is in the right catagory)
I have just used find, which was new to me, and previously I used locate or whereis, and all three have returned different results!! Whats the difference and which is the best?
Ben |
|
Back to top |
|
|
dgt84 Guru
Joined: 27 May 2003 Posts: 355 Location: Germany => USA
|
Posted: Thu Jun 12, 2003 8:22 am Post subject: |
|
|
I personally prefer locate, but you need to updatedb very often so that the database is up to speed. Try running updatedb, then run locate, slocate, find, etc... they should all return the same results. I don't know too much about whereis, use it occaisionally to find executables... _________________ Lila themes | The Porthole Portage Frontend | SVG-Utils |
|
Back to top |
|
|
bokkepoot Tux's lil' helper
Joined: 14 Mar 2003 Posts: 123 Location: The Hague, The Netherlands
|
Posted: Thu Jun 12, 2003 8:40 am Post subject: |
|
|
whereis uses a hardcoded path to search for commands and manpages etc.
(s)locate uses a (prebuilt) database to search for files, which may or may not include the directory your 'wanted' file resides in
find traverses a user given path on a live filesystem to search for the requested files.
So it all depends on what file you are looking for, if its a file that is likely to be in default system path, whereis works probably best, if its eg. a truetype font slocate will be your best shot, if its about files in directories updatedb (used for creating the slocate db) probably won't update, like nfs or user-homes, find will do the trick.. It all depends where you think it might be. |
|
Back to top |
|
|
Yarrick Bodhisattva
Joined: 05 Jun 2002 Posts: 304 Location: Malmö, Sweden
|
Posted: Thu Jun 12, 2003 12:29 pm Post subject: |
|
|
'which' can also be useful |
|
Back to top |
|
|
zephyr1256 Apprentice
Joined: 10 Mar 2003 Posts: 170 Location: Kingsport, TN
|
Posted: Fri Jun 13, 2003 2:40 am Post subject: |
|
|
'which' is my favorite command for finding binary executables. It has become most indispensible as of late while I'm working on a basic Linux system on a pair of floppy disks. I need to find out dependencies, etc, for a binary, and I can just do something like:
And I don't have to worry about 'which' directory the file is in, or for copying the executable to its place in the file system. This could be useful if you were making a script to probe for dependencies of binaries in a filesystem, but you didn't want it to be hard coded to a specific distribution's conventions regarding where they are located. _________________ The Congress shall have power...To promote the progress of science and useful arts, by securing for limited times to authors and inventors the exclusive right to their respective writings and discoveries; --U.S. Constitution. Article 1, Section 8. |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9527 Location: beyond the rim
|
Posted: Fri Jun 13, 2003 4:53 pm Post subject: |
|
|
Short answer:
- which is for finding executables
- whereis is for finding manpages, libraries, headerfiles and excutables
- locate is for all files, but it often finds way too much files, a custom find-command is better |
|
Back to top |
|
|
|