There are many commands in Linux to see the path of a file, and here is a little summary.
1, Find command
The find command should be the most familiar when it comes to finding commands, and is also the most powerful find command in Linux. It can find any file you want in the specified directory. How to use:
Find < Specify directory > < specify conditions > < specify Actions >
If any of the parameters do not indicate a search for the current directory and its subdirectories, no results are filtered and they are displayed on the screen. Examples of Use:
Find. -name test means searching for a file named Test in the current directory
find/home/xiang-amin-2 Find files that have been accessed in the last two minutes under the specified directory
There is a lot more to be specified about find, which can be seen in detail.
The essence of 2,locate is find-name, but locate's execution efficiency is much faster than the Find command, because its search is not directory-based, but to search/var/lib/locatedb this database file. In order to prevent too many files listed, the general and GREP commands work together to locate files in a specific directory. The Linux system automatically creates this file and updates it automatically. To avoid searching for newly created files, it is a good idea to run the UpdateDB command before using it. Usage of Locate:
Find < file name >
Use example: Locate test finds all the files that begin with test.
3,whereis
This command can only be used for binary files, man file and source code file search,-B for Search binary executable,-M for man file,-s for source file
Whereis pwd location of all PWD files
In addition, which and type also have the ability to search for files in some cases, because they are not often used in practice and are not described here.
3 Find commands for Linux