Linux wildcard character __linux

Source: Internet
Author: User
Body test Data
Touch a a6.log abc.log ac.txt b c C5.txt X.log a
"*"

Represents any number of characters

Example: Query with ". Log" end of file

ll *.log
"?"

Represents any single character

For example: Only query A, B, C

ll?
"[]"

Represents a character between "[" and "]", for example, [0-9] can represent any number between 0-9, [a-za-z] can represent any letter between a-Z and a-Z, and the letters are case-sensitive.

Example: Only query the alphabetic file

ll [a-za-z]

Example: The query ends with ". Log" and a file with only two characters before ". Log" and the second character is the number

ll? [ 0-9].log

"^"

Indicates the meaning of the match result, note that this wildcard must be used in []

Example: A query is not a file that ends with ". Log"

ll *[^txt]*

"{}"

To represent multiple files contained within parentheses

Example: File

ll {*.log,*.txt} at the end of query '. Log ' and '. txt '

Note: "." This is particularly true if the matching condition adds the match so that the query result file contains the band "." of the file

Example of the preceding "^", if I query "ll *." [^txt]*], then the result is not the same

Delete Operation

For example: Delete A, B, C, and files ending with. txt

rm-f {[Abc],*.txt}

Summary

Of course, if you can query, of course, you can also use wildcard matching to move the file, if you need to move certain types of files in a folder where there are many files, the efficiency of using wildcard matching is obvious; At that time, the use of wildcard characters is not only these, there is free to study more.

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.