Tag Archives: which

How to search files or folders in Ubuntu

1. Whereis + filename

is used to search the program name. The search results are limited to binary files (parameter -b), man description files (parameter -m), and source code files (parameter -s). If the parameters are omitted, all information is returned.



2. The find/name + filename

find is in the specified directory through the search, if the directory using/means in all directories to find, find way to find the file is expensive, the speed is a little slower.



3. Locate + filename
Linux will record all the files in the system in a database file. The method of using locate+ file name will find the target in the database maintained by Linux system. Compared with the way of find command to traverse the disk to find, this method is much more efficient.


The problem with

is that the database files are not updated in real time and are typically updated weekly, so the results found with the locate command may not be accurate. You can of course update the database with the updatedb command before using locate to ensure that the results are correct.


4. Which + executable file name

wh0 ich 0 ich

0.

.


, so basic function is to look for executable files in the directory set by the environment variable $PATH.