Linux wildcard, linux wildcard

Source: Internet
Author: User

Linux wildcard, linux wildcard

Learning wildcards is a bit of a basic feeling for regular expressions ...... I have learned Regular Expressions in python before, so this blog is still very fast.

Special symbols
| # Pipeline character, or (Regular Expression)> # output redirection> # output append redirection <# input redirection <# append input redirection ~ # The current user's home directory ''$ () # reference the result $ # After the command is executed... End (Regular Expression) ^ #... Start with (Regular Expression) * # match all characters. What are the wildcards? # Any character, wildcard ## Note & # Switch the program or script to the background for execution & # And set [] # to indicate a range (regular expressions, wildcard characters) {}# generate a sequence (wildcard ). # Hard link of the current directory .. # Hard link of the parent directory
Wildcard

It is a built-in function of shell.
Wildcard characters, which are common and should be well understood when DOS is used.
A wildcard character string "?" That contains these characters. "*", "[]", {}

Wildcard characters ==> match file names

 

Symbol Function
* Match any string/text, including null strings; * represents any character (0 or multiple) ls file *
? Match any character (when not in parentheses )? Represents any 1 character ls file 0
[Abcd] Match any character in abcd
[A-z] The range is a to z, indicating that the range means [] matching any character in brackets ls file 0
{..} Generation sequence. separated by commas (,) and no space is allowed.
Supplement  
[! Abcd] Or [^ abcd] indicates no, indicating that it does not match any character in the brackets

Wildcard details

? Any one character

[Abcd] indicates matching any character in the brackets.

  • {} Generation Sequence

  • [] Used to find a file (matching the file name)

Back up {}

[^ Abcd]! ^ Indicates non, reverse

[] And {}

  • [] Can only be used to find files
  • {} Is used to find a file or create a file to generate a sequence.

 

Special symbols
Command 1 | command 2 ### pipeline symbol, which is a common text and string passed by the previous command. | Xargs ### pipeline symbol. Use the xargs Pipeline character command to convert a string to a file name.
Directory structure
. # Current Directory (or "any character" regular) .. # The upper-level directory of the current directory
Redirection symbol
> # Output redirection: the original content is cleared, and content is appended to the file >># append output redirection, append to the last line of the file <# input redirection tr xargs <# cat is used to append multiple lines of text to the file

 

Unclassified special symbol # comment

Linux will ignore him and explain it to the O & M personnel.

$ Reference a variable to a variable value or a command prompt from a common user

1. shell
$ Variable: Get the content in the Variable

2. awk
$ Retrieve column $ number

3. Command Prompt for common users

'(Below esc) refers to the result of referencing the command in reverse quotes, which is equivalent to $ ()

; Separate multiple commands, no logical relationship, just one step

1. shell

2. sed

[root@chengliang ~]$ seq 100 | sed -n '20p;50p;100p'2050100
Cd-; su-
  • Cd-### return the last working directory and the last position
  • Su-### switch users,Reload Environment Variables

 

~ Home Directory of the current user, home
[Root @ chengliang ~] $ Cd ~ Returns the Home Directory of the current user.

 

\ Escape characters or alias Blocking
. # (Any character in the regular expression) \. # it only represents the symbol of a vertex.

 

! Indicates non-

Indicates force
Vi/vim
Vi force exit (: q !)

 

& Represents and

Note:& The symbol indicates that the subsequent command is executed only when the command of the current edge is successfully executed.

Single quotes, double quotes, no difference in quotation marks

  • Single quotes: What you see is what you get.

  • Double quotation marks: special characters are parsed. special symbols have special meanings.

  • No quotation marks: Special. Wildcards are supported.

 

Reference blog: http://www.cnblogs.com/chensiqiqi/p/6280351.html

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.