b5media.com

Advertise with us

Enjoying this blog? Check out the rest of the Technology Channel Subscribe to this Feed

New Linux User

HOWTO: Find a File on My GNU/Linux System?

by Jon on November 5th, 2005

Where did that pesky application install itself? If you’re like me, you’ve lost your fair share of files over time. Whenever I can’t find something, I use one of three utilities: find, locate, and whereis.

Find

Probably the most reliable, but slowest, way to find a file is to use the find command. At its simplest, the find command is:

find < directory > -name < filename >

Put the top directory that you want find to start looking in and give it a partial or full filename and you’re ready to go. For example, if I know that I have a file named mydoc somewhere in my home directory, I can use:

find /home/jon -name mydoc

As always, use the man find command to discover more stuff you can do with this command.

NOTE: the find command can only search directories that the current user has rights to. Therefore, if you want to be sure that you’re looking in ALL directories, become the root user before using the find command.

Locate

Unlike the find command, the locate command references a database of files on your system to find files instead of acutally peeking into the file system to find them.

In its simplest form, the locate command is:

locate < filename >

You supply the file name and locate will spit out all the files on the system that contain that file name. Note that partial filenames are OK (ie ‘locate flux’ will find ‘fluxbox’ and ‘fluxbox.desktop’).

Use man locate for more information on this command.

Whereis

There whereis command will show you the location a file’s binary, its source, and its man page if all of them exist on your system.

It its simplest for, the whereis command is:

whereis < filename >

You supply the filename and whereis will show you where the binary, source, and man page is for that filename.

Have I mentioned you should check man whereis for more detailed info?

POSTED IN: How To

0 opinions for HOWTO: Find a File on My GNU/Linux System?

  • No one has left a comment yet. You know what this means, right? You could be first!

Have an opinion? Leave a comment:




Check Spelling
Activate Spell Check while Typing