On Linux, how can I quickly find a file?
I have seen one sentence before: the level of Linux is reflected in the quick file searching ~~~ , Maybe this sentence is actually said.
But on Linux, everything is a file, and anything we want to do can be done by editing the file, such as server configuration and maintenance. Everything is in the process of dealing with files ~ ·~ ·
Next I will show you how to quickly find a file
Assume that
Find the script file (Execution file) which filename
Find the binary file (Execution file) whereis-B filename
Find the specific file whereis filename (using the database)
Part of the locate file name (search by database)
The above description uses database search and the database is a file with all files on your computer. Is it clear?
That is, file/var/lib/mlocate
Use locate when you cannot remember the full name of the file. You can also use the search command to add the wildcard *
For example, find the file yum. conf.
Whereis yum .*
The screen will output a file prefixed with yum.
Next, I will introduce a powerful but time-consuming command. How long will it take? Because it is a direct hard disk search
We know that we need to extract the content from the hard disk to the memory.
Is it powerful? Look down
Find/etc-mtime 3 what does it mean? Is to find the modified files on the day three days ago.
It is very useful. For example, we configured the server in January November 11, 2014. We want to see
If you have modified the file, enter find/etc-mtime 3 on the client.
Find/boot-newer/boot/gurb. conf
Find new files under the/boot directory than/boot/gurb. conf
Search for files belonging to fuchao in the root directory
Find/home-user fuchao
Find Files that do not belong to anyone in the system (ps: this is a bit interesting ~~~)
Find/-nouser
Search for files with special permissions
Find/-perm + 7000 --- s -- t
Locate/-perm + 600
Detailed description of the find command in Linux
Use of find, a text search tool
Powerful find command
Detailed description of the find command in Linux
This article permanently updates the link address: