Linux/unixshell's "find" usage has been a long time ago, and I have moved out to share it with you: parameter explanation: find is used to query files in a directory. common parameters are as follows:-path is followed by the path www.2cto.com-prune, indicating that the query in the directory is no longer specified... I 've been taking notes for a long time before using the find command in linux/unix shell. I want to share it with you: parameter explanation: find is used to query files in a directory. common parameters are as follows:-path is followed by the path www.2cto.com-prune, indicating that the query in the directory is no longer specified. if-depth is used at the same time, -The prune command will ignore the name of the file to be queried. you can use a regular expression to query the file changed in the last n days of-mtime query. + The value is greater than n, -n indicates that the value is less than n days. In addition, the usage of-atime and-ctime is similar to that of-newer file1! -Newer file2 indicates that the query is newer than file1, and the file-exec older than file2 indicates that some command operations are performed on the queried file, such as-exec ls-l {}\; -type: the file type to be queried! -Type d indicates the demonstration of file + 10c or-10c with a size greater than 10 bytes except for the-size specified by the directory type, or smaller than 10 bytes: [oracle @ localhost testDir] $ cat find. sh echo "prune:"> find. outfind. -path ". /folder "-prune-o-name" file * "> find. outecho "-name:"> find. outfind. -name "[a-z] [a-z] *"> find. outecho "-mtime: + 3"> find. outfind. -mtime + 3> find. outecho "-mtime:-3"> find. outfind. -mtime-3> find. outecho "find newer then 1 and older th En 2 files: "> find. outfind.-newer" test1.sh "! -Newer "test2.sh"-exec ls-l {}\;> find. outecho "-type:"> find. outfind. -type d> find. outecho "doesn t type:"> find. outfind .! -Type d> find. outecho "-size + 10c:"> find. outfind. -size + 10c> find. outecho "-size-10c:"> find. outfind. -size-10c> find. output result: [oracle @ localhost testDir] $ cat find. out prune :. /folder-name :. /blank_file. /find. sh. /shelltest. sh. /folder. /folder/file1./test1.log. /test1.sh. /test2.sh. /main. sh. /find. out-mtime: + 3. /find. sh. /shelltest. sh. /folder. /folder/file1./test1.sh. /test2.sh. /main. sh-mtime:-3 .. /blank_file. /test1.log. /find. outfind newer then 1 and older then 2 files:-rwxr-xr-x 1 oracle oinstall 100 Nov 10. /test2.sh-rwxr-xr-x 1 oracle oinstall 26 Nov 10. /main. sh-type :.. /folderexcept type :. /blank_file. /find. sh. /shelltest. sh. /folder/file1./test1.log. /test1.sh. /test2.sh. /main. sh. /find. out-size + 10c :.. /blank_file. /find. sh. /shelltest. sh. /folder. /test1.log. /test1.sh. /test2.sh. /main. sh. /find. out-size-10c :. /folder/file1
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service