- Outline
- Wildcards
- background
- It has been hard to tell wildcards and regular
- Wildcard is a simple means to find
- When bother with regular, it is a good way
- ready
- the
- centos7
- table of Contents
- /etc
- command
- ls -d
- -d
- If you filter out the directory, ls directory will not unpacking
- If you do not follow regular, returns only.
- -d
- ls -d
- the
1. wildcard
- Outline
- Wildcards
- wildcard
- Wild card?
- Wildcards
- description
- A character
- Can in the search, instead of any other character
- A character
- benefit
- Improve the flexibility and efficiency of the search
- description
- scenes to be used
- ls
- find
- Other welcome supplement
2. * wildcard
- Outline
-
- Wildcards
-
- effect
- Match any type of [0, + infinity] characters.
- Of course, linux path length, there is an upper limit
- Match any type of [0, + infinity] characters.
Scenario 1: match a specific file suffixes
# . 在通配符里, 是 普通字符, 不要和 正则 弄混了 # .conf > ls -d *.conf # .d > ls -d *.d
Scenario 2: match specific prefix file
# sys > ls -d sys*
3.? Wildcard
- Outline
- ? Wildcard
- effect
- Match any type of single character
Scene: Find suffix length fixed content
# 后缀长度为 1 > ls -d *.?
4. [] wildcard
- Outline
- [] Wildcard
- effect
- Matches a single character within []
Scenes
> ls -d [a-z]* > ls -d *[a-z]* > ls -d *[A-Z]* > ls -d *[0-9]* > ls -d *[a-Z]* > ls -d *[a-f]* > ls -d *[a-fxyz]* > ls -d *[a-zA-Z0-9]*
5. [!] Wildcard
- Outline
- [!] Wildcard
- effect
- Anti menu characters
Scenes
# 不是 小写字母开头 的文件 > ls -d [!a-z]
5. {}
- Outline
- {}
- This seems not a wildcard
- But many local wildcard, you can also use
- effect
- Selecting a plurality of yige in str
Scenes
# 查找 sysco 或者 sysct 开头的 目录 或 文件 > ls -d sys{co,ct}*
6. Other
- In fact, even these things, but I'm not sure whether they belong to the wildcard, not sure how to use
- [:alpha:]
- other
ps
- ref
- Follow-up
- Probably before finishing the regular, then move out of it