Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

File wildcard

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

I. document wildcards

Wildcards are mainly used to find matching characters by setting certain conditions.

* match any character, including 0

? Match any single character

~ username: matches the home directory of username

Cp / root/file1 ~ tom/ #: copy the file1 file to the tom user's home directory

~ match to the current home directory

[abc] matches to any letter in abc

[^ abc] matches to any character except abc

[0-9] matches any number between 0-9

[amurz] matches any letter between aAbBcC-z

[Amurz] matches any letter between AbBcC-zZ

[: alpha:] matches any letter

[: digit:] matches any number

[: alnum:] matches any letter or number

[: upper:] matches any uppercase letter

[: lower:] matches any lowercase character

[: punct:] matches any symbol

[: space:] matches any space

Exercise:

1. Display all files or directories in the / var directory that begin with I, end with a lowercase letter, and have at least one digit in the middle

Ls / var/I* [1-9] * [[: lower:]]

2. Display files or directories under the / etc/ directory that begin with any number and end with a non-number

Ls / etc/ [0-9] * [^ 0-9]

3. Display files or directories in the / etc/ directory that begin with a non-letter, followed by a letter and any other characters of any length.

Ls / etc/ [^ [: alpha:]] [: alpha:] *

4. Display all files or directories under the / etc/ directory that begin with m and end with a non-numeric end

Ls / etc/m* [^ 0-9]

5. Show all files or directories ending in .d in the / etc/ directory

Ls / etc/*.d

6. Show all files or directories in the / etc/ directory that end with .conf and begin with mreco ndir r rep.

Ls / etc/ [mnrp] * .conf

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report