Find the difference between linux command find, locate, whereis, which, type of

find

find is the most common and most powerful Find command, you can use it to find any file you are looking for. And query the database (/ var / lib / locatedb) different files, find looking for is disk space.

locate

locate command is actually "find -name" is another way, but much faster than the latter, because it does not search for a specific directory, but searching a database (/ var / lib / locatedb or / var / lib / mlocate / mlocate.db), this database contains information on all the local papers. Linux system to automatically create the database, and automatically updated once a day, so use the file directly locate command finding out the latest changes before. To avoid this, before you can use locate, first use the updatedb command manually update about the database.

whereis

whereis command can only be used to search the program name, and only search binary files (parameter -b), man documentation (parameter -m) and source code files (parameter -s). If the parameter is omitted, all the information is returned. Like locate, query the database (/ var / lib / locatedb) file.

which

Action which command is specified in the PATH variable path, searches the position of a system command, and returns a search result first. In other words, the use of which command, you can see whether there is a system command, and in the end which is a position of command execution.

type

In fact, type command can not be considered the Find command, which is used to distinguish a command in the end is a shell built-in, or provided by an external shell of independent binary files. If a command is an external command, then use the parameter -p path displays the command, which command corresponds.

Reproduced in: http://www.phpernote.com/linux/1205.html

Guess you like

Origin www.cnblogs.com/7haoyu/p/11527486.html