This method is as simple and easy to understand as finding files under WINDOWS. If you put this file in a separate folder and can easily find it with the commonly used "ls" command, then using the "find" command to find it will not leave a deep impression. After all, the powerful function of the "find" command does not stop there. If you know the file name of the file, but don't know which folder to put it in, even a nested folder. For example, suppose you forget that online search is easier. "The search assistant also includes an indexing service, which maintains an index of all files in the computer, making the search faster. When using the Search Assistant, users can specify multiple search criteria. For example, users can search files and folders by name, type and size. Users can even search for files that contain specific text. If users use Active Directory, they can also search for printers with specific names or locations.
For example, we know that the size of a Linux file is 1 500 bytes, so we use the following command to query find/-size 1500c, and the character c indicates that the size of the file to be searched is in bytes. If we don't even know the specific size of this file, then we can also do fuzzy search in Linux to solve it. For example, if we enter the command find/find/-size+1000000c, it means that we specify the system to find files with more than/kloc-0 10000000 bytes in the root directory and display them. The "+"in the command means that the system is required to list only files larger than the specified size, while the "-"means that the system is required to list files smaller than the specified size. The following list is what the system will do after using different "find" commands in Linux. It is not difficult to see that there are many ways to use the "find" command in Linux. As long as you use the "find" command flexibly, your search ability in WINDOWS is not necessarily poor.
Find/-amin-10 # Find the files accessed in the last 10 minutes in the system.
Find/-atime -2 # Find files accessed in the past 48 hours in the system.
Find/-empty # Find an empty file or folder in the system.
Find/-group cat # finds files belonging to group cat in the system.
Find/-mmin -5 # Find files that have been modified in the last 5 minutes in the system.
Find/-mtime-1 # Find files that have been modified in the last 24 hours in the system.
Find/-nouser # Finds files belonging to invalid users in the system.
Find/-user fred # Find files belonging to user fred in the system.
The following list is part of the conditions for searching for file characteristics, which can be specified by the find command. Not all search criteria are listed here. You can refer to the related books of Linux to understand all the search functions of the find command.
Amin n
Find the files accessed in the last n minutes in the system.
time
Find the files accessed in the last n*24 hours in the system.
-cmin n
Search the system for files whose status has changed in the last n minutes.
time
Find the files whose status has changed in the last n*24 hours in the system.
-It's empty
Find a blank file in the system, or a blank file directory, or a folder without subdirectories in the directory.
-Fake.
Find files that always go wrong in the system.
-fstype type
Find files in the specified file system, such as ext2.
gid n
A file with file number group ID n was found in the system.
-Group name
Searches the system for files whose files belong to the gnam filegroup and whose group and ID are specified.
* find command control options:
The Find command also provides users with some unique options to control the search operation. The following table is the control options and usage of the most basic and commonly used find command that we summarized.
Option usage description
-daystart tests system files within 24 hours from today, similar usage -amin
-depth uses the depth level search process, and first searches the file contents in the specified directory at a certain level.
-Search by wildcard links; In addition, you can also ignore wildcard link queries.
-help displays the command summary.
-Maximum depth level
Search in hierarchical directory according to decreasing method.
-Mount
Do not search in the file system directory, which is similar to -xdev.
-noleaf prohibits optimized search in non-UNUX file systems, MS-DOS systems and CD-ROM file systems.
-version prints the version number.
Note: With the -follow option, the find command will follow the wildcard link to find the file. Unless this option is specified, the find command usually ignores wildcard links to find files.