Notes on the find command in Linux-general Linux technology-Linux programming and kernel information. I don't catch a cold on becoming a linux system administrator, but who makes me a serious interest-oriented plus breadth-oriented learning.
From the first day of access to linux, I need the find command, for example, looking for the damn ones. c ,. where is the H file, or a configuration file. where are etc and so on. Compared with windows Search, the find command is a little troublesome. To complete a specific task, you have to think a lot about it, and man find is so disgusting that you cannot understand it. Just touch the stones and cross the river. Take it easy.
Example 1:
For example, if you want to find all *. file files in a directory, but want to skip the test1 subdirectory, test2 subdirectory, test3 ......
Then, a "." can be omitted to indicate the current directory.
Next, "\ (" and "\)" appear in pairs. Here "()" indicates that shell does not explain the things in parentheses, give it to the find command for explanation. Well, that's exactly what it said. I don't know the specifics, especially what it is called "shell doesn't explain, just give it to find to explain". Whatever it is, just write it.
Note that there must be spaces before and after "\ (" and "\)". Otherwise, an error may occur. \ (-path "is not allowed and must contain spaces.
-Path "path"
Here, each-path corresponds to a subdirectory that you want to ignore, and there must be spaces behind-path, which cannot keep up with the directory.
Single quotes and double quotes do not matter. One is a strong quote and the other is a weak quote. The difference is certainly there, but it has not been understood yet.
Each-path "path" is followed by a-o representation-or a string of paths connected with this-o
Then the-prune option, which means "cut down"
Another-o will be explained later.
The following is more common. Select the file type with "*. file" as the file name. Note that the double quotation marks can be omitted here (alas, leave this double quotation mark alone and stay dizzy here)
Okay, the key is-o
In fact, a bunch of-a "-and" are omitted"
Meaning:
If
. \ (-Path ". /test1 "-o-path ". /test2 "-o path ". /test3 "....... -o path ". /testX "\) created
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.