Summary of knowledge points for special symbols (wildcard characters)

Source: Internet
Author: User

# #特殊符号与正则表达式的区别

# () in Awk/sed/grep special symbols used in the - Regular Expressions

# () Special symbols used in the command line or script--the following special meanings

# #特殊符号 (wildcard) list

input redirection

mail-s 1091***** @qq. com </etc/hosts.txt  

    # #将host content written in. txt message content

> Output redirection
>> Append output redirection Do not overwrite the previous content, continue to write the appended content at the end of the document
pipeline The results from the previous command are passed to the next command as parameters using the
\ Escape character Let characters with special meanings remove special meanings, such as "." (represents the current directory), "\." Represents only "." ; For example, "$" (representing the End), "\$" means the $ itself
* Match all That is, any character repeats n times, similar to the regular ". *"
? Match any one character Similar to "." In the regular
$ Reference variable The end of a line is represented in a regular
# Annotation characters Typically a comment in the configuration file so that the line does not explain
~ Current User Home Directory
. and./ Current directory or hidden file

Example: Ll-a/ROOT/.BASH_RC

.. And.. / Current directory Top level directory

Cd. # #当前目录

Cd.. # #返回当前目录的上一级目录

CD-# #返回上一次所在的目录

/ root directory or path delimiter
; Command delimiter Two commands are executed on the same line, then with ";" Separated
{} (1) generating a character or sequence of characters
(2) Find is used to mean "the result of the preceding command"

(1) Generally with Echo and other commands used, similar to Seq.


# #同时创建3306和3307, 3308 directories

mkdir stu{001..100}

# #同时创建100个目录, stu001.stu002...stu100

echo {1..100}

# #产生1 sequence of 2 3...100

(2) Use with find-exec command

find/et/-type f-name "ssh.bak*"-exec rm-f {} \;


Only the previous command cannot be executed correctly, the following command is executed

ech >>/dev/null | | Echo 2

and, with

The following command is executed only if the previous command succeeds

Span style= "Font-size:16px;color:rgb (255,0,0); font-family: ' Microsoft Jas Black ', ' Microsoft Yahei ';" > "

Two anti-quotes

(parameters of the reference command)

echo ' Date '
' '

two single quotes

output what you see and what you see is what you output

(only the reference to the variable within "cannot take effect, But the meaning of the special symbol is reserved)


Two x double quotes

(with variable displacement function)

the variable output that can parse the call

(If there is "in the referenced content, keep the reference symbol different, use" ", and vice versa)

! Invokes the most recently used command, argument, or inverse

!+ number indicates the first order to recall history

!! Represents a command that uses the last action

!+commond represents the most recent command to use the beginning of the command

!$ represents the last used parameter (variable)


Cat!$ shows the same results

"Non", Take counter: (! In front of which parameter, the argument is reversed)

find/home/jason/! -type f-name ""

# #搜索不是文件类型, but the name is

find/home/jason/-type F! -name ""

# #搜索文件名不为a. sh file

Find "or" "- o"

find/home/jason/-type f-name ""-o-name ""

# #搜索文件名为a. Sh or files

Find "and"-a "

find/home/jason/-type f-name "*"-a ctime-15

# #搜索包含a. sh file, and when the file is modified

Summary of knowledge points for special symbols (wildcard characters)

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: 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.