Commonly used file search commands in Linux include which, whereis, find, locate, and type. The specific usage is not involved here, but the differences between them are compared.
Which: searches for the location of a system command in the path specified by the PATH variable and returns the first search result. When the-a parameter is added, all search results are returned.
Whereis: it can only be used for searching program names. It only searches binary files (-B), description files (-m) in the manual path, and source code files (-S) and other special files (-U ). If the parameter is omitted, all search information is returned. In Linux, all files in the system are recorded in a database file. Whereis uses the database to find data, which is fast and does not actually query the hard disk, saving time.
Find: it takes a long time to directly search for the hard disk. This command can find any file you want!
Locate: The function is equivalent to find-name, but it is much faster than the latter, because the locate command is also used for database search. However, because the database is updated once a day by default, all newly created files may not be found using the locate command. In this case, you need to manually update the database. The command is very simple. Just enter "updatedb!
Type: this command can be used to differentiate whether a command is provided by an independent binary file (builtin) provided by bash or an external bash (provided by other non-bash. If an imperative external command is used, the-p parameter will show that the path of the command serves as which.