Locating Files and Directories
There may be times when you know a file or directory exists but you do not know where to find it.
There are several commands
you can use to search for it.Such as "find", "locate", and "which".
Find
The format of the find command is:
eg: find path pattern
If you do not specify a path, find starts in the current working directory and looks through all subdirectories for the specified pattern.
The find command has many options that you can review by entering man find at a shell prompt.
Locate
The format of the locate command is:
eg: locate pattern
With locate, you can see every file or directory whose name contains the search criterion.
The locate command works very quickly, as long as the database is up to date. That database is automatically updated on a nightly basis through a cron job. cron is a small program that runs in the background, performing various tasks (such as updating the locate database) at regularly scheduled intervals. Refer to the RedHat Enterprise Linux System Administration Guide for more information on cron.
To update the database manually, log in as root (type su - at a shell prompt and then your root password) and type the command updated.
After a few minutes, the slocate database that is used by the locate command is updated.
which
The format of the which command is:
eg: which command
which returns the location of binary, or executable, shell commands. The information provided by whichis useful for creating application launchers.
whereis
The format of the whereis command is:
eg: whereis command
whatis
The format of the whatis is:
eg: whatis command
      send to a friend                   moby@mylinuxplanet.com