In linux, there are some simple ways to use the find command. In windows, you can click search to find the desired files and folders, but linux is not so convenient. In linux, the find command is generally used. Its usage is also very broad. here I just record some simple, easy to find, like I am waiting for the white dedicated, Daxia bypass. An example is provided to illustrate how to search for a file by file name. I will search for ngin on a VPS with LNMP installed.
In linux, there are some simple ways to use the find command.
In windows, you can click search to find the desired files and folders, but linux is not so convenient. In linux, the find command is generally used. Its usage is also very broad. here I just record some simple, easy to find, like I am waiting for the white dedicated, Daxia bypass.
Search for a file by file name
Let's take an example to illustrate how to find the nginx. conf file on a VPS with LNMP installed.
[Root @ ZR/] # find/-name nginx. conf
./Usr/local/nginx/conf/nginx. conf
As shown above, use the find command to add-name, and/to find the Directory (if we know more detailed directories, you can also write it), and then the file name to be searched, you can find the file with this name.
Search for a file with an incomplete file name
Incomplete file names are part of the file name. for example, if we know that there is a conf file starting with wp, we want to find it.
[Root @ ZR/] # find/-name 'WP *. Conf'
/Usr/local/nginx/conf/wp2.conf
We can also find this file easily by using the above command. Please note that if we know that the file name only contains the two letters wp, not starting with wp, we can write it as * wp.
Search by file features
The file features include the file size and so on. we will look up the file size as an example.
Find/-size 1500c # find the file with a size of bytes
Find/-size + 1500c # search for files larger than 1500bytes
Find/-size-500c-size + 50c # search for files larger than 50bytes and smaller than 500bytes
This command is very interesting and can be used flexibly. for example, you can change the/directory to the directory you specified.
Other advanced search methods
There are many ways to use the find command. if you are familiar with the operation method, it is helpful and harmless. I will list some of them here.
Find/-amin-10 # search for files accessed in the last 10 minutes in the system
Find/-atime-2 # search for files accessed in the last 48 hours in the system
Find/-empty # search for files or folders that are empty in the system
Find/-group cat # find the groupcat file in the system
Find/-mmin-5 # search for the files modified in the last 5 minutes in the system
Find/-mtime-1 # search for files modified in the last 24 hours in the system
Find/-nouser # search for files belonging to the void user in the system
Find/-user fred # search for files belonging to the user FRED in the system
Some of the commands are too advanced. I don't want to use them, and I don't bother to remember them. if you need them, you can use the search engine to find them.