find is one of the best commands in linux, and its query function is very powerful. Most of the usage of find is detailed below: How it works: It traverses down the file hierarchy, matches the files that match the criteria, and performs the appropriate actions.
- 1.Printing files and directory listings
- $find . -print #Printing files and directory listings
When using -print, ’\ ’ as a delimiter for separating files. -print0 indicates that ’\\0’ is used as a delimiter to print each file name that matches. This method is very effective for file names with ’\ ’. However, after the actual test on centos, find directly displays the matching file, without the -print option. 2. Match the search option according to the file name or regular expression -name specifies the string that the file name must match.
- $find . -name " *.txt" -print # Print files ending with .txt
- $find . -iname "*.txt" -print #-iname indicates that the matching file name ignores case
3. Conditional constraints, matching one of several conditions -a: means and -o: means or -not: means not
- $find . (( -name "*.txt" -o -name "*.pdf" \\) -print #Print the file ending in .txt or .pdf in the current directory
- $find . \\( -name "*.txt" -a -name "a*" \\) -print #Print the file starting with a and ending with .txt in the current directory
- $find . -not \\( -name "*.txt" -a -name "a*" \\) -print #Print files that do not start with a or end with .txt in the current directory
- $find . -not \\( -name "*.txt" -o -name "a*" \\) -print #Print the file in the current directory that does not start with a and does not end with .txt
-not usage is derived from De Morgan's law, see http://en.wikipedia.org/wiki/%E5%BE%B7%E6%91%A9%E6%A0%B9%E5 %AE%9A%E5%BE%8B
-path: This parameter is used to match the file path as a whole.
- $find /home/user -path "*sh" -print
- /home/user/bin/1.sh< Br>
- /home/user/bash
- -regex : This parameter is similar to -path except that it matches the file path based on regular expressions.
- $find . -regex ".*\\( \\.py \\
How to install and set up SVN server tool/material operating system on Windows: Windows2003
u disk is an indispensable tool in our daily life. We often use it to store files. However, in the p
In the process of using the u disk, we will inevitably encounter some problems. For example, sometim
Perhaps it is the release of the Windows 9 technology preview, and the news about Windows 9
What if the League of Legends can't see the word box?
About the "hard disk installer" can not click to determine the problem
How do I log in to WeChat on my computer?
Solve the volume icon is not a problem
Demystifying the use of the Ping command
Microsoft repaired 23 vulnerabilities including IE/Win7/Win8 in March.
How can I stop IE from sending bug reports?
How to prevent hackers from attacking the system again through the Web
How do you quickly distinguish whether the system is 32-bit or 64-bit?
Teach you to identify the Windows 8 system trusted website
Forget WinXP user passwords with script recovery
Win10 Preview 10537: New icon/shop application animation and other improvements
How to let win8.1 Enterprise Edition keep the original installer and files after upgrading win10
Add a "hibernate" command to the Win8 power option.
How to modify the Win10 "File Explorer" target to point to
Win7 my document to restore the default directory location method
Win10 preview version 10102 system taskbar icon setting method graphic: