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

Introduction of system basic symbols

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1. Introduction of system basic symbols

1) basic symbol series

Dollar sign $

Used to remove the contents of a variable

Used to fetch the contents of the specified column (awk)

Awk 'print $2' file to view the second column of information in the file

Represents a user command prompt symbol

Super user #

Ordinary user $

Represents the end of a line

Exclamation mark:!

Used to express the meaning of turning or excluding

The command indicates that the most recent command is taken out

! Awk (use with caution)

History | grep awk

History (View History Command)-c (clear History Command)-w (Save History Information)

Cat ~ / .bash_history record

Ctrl + r

Used to indicate mandatory operation processing

Vim bottom line mode save exit wq! Q!

Vertical bar symbol: | indicates the pipe symbol. The command in front of the pipe is handed over to the back of the pipe for execution.

Often used with the xargs command

Find the specified data information to delete

Find / oldboy-type f-name "oldboy.txt" | xargs rm

Find / oldboy-type f-name "oldboy.txt"-exec rm-rf {}\

Find / oldboy-type f-name "oldboy.txt"-delete

Find the specified data information for replication

Find / oldboy-type f-name "oldboy.txt" | xargs-I cp {} / oldgirl/

Find / oldboy-type f-name "oldboy.txt" | xargs cp-t / oldgirl/

Find / oldboy-type f-name "oldboy.txt"-exec cp-a {} / oldgirl\

Find the specified data information to move

Find / oldboy-type f-name "oldboy.txt" | xargs-I mv {} / oldgirl/

Find / oldboy-type f-name "oldboy.txt" | xargs mv-t / oldgirl/

Find / oldboy-type f-name "oldboy*.txt"-exec mv {} / oldgirl\

Find the specified data information by date

Find data from 7 days ago: find / oldboy-type f-mtime + 7

Find data for the last 7 days: find / oldboy-type f-mtime-7

Find the data on the 7th day: find / oldboy-type f-mtime 7

Mainly used for batch deletion of historical data information

| produces output information | grep xxx |

Rpm-qa | grep vim

View and confirm that vim is installed

Pound sign: #

It is the annotation symbol of the file content.

Represents a user command prompt symbol

Superuser is #

The average user is $

2) quotation mark symbol series

Dollar parentheses $() = ``same function

Indicates that the result of command execution is left, which is used for other command calls.

Quotation marks:

Double quotation marks "": indicates the input, that is, the output, but some of the information will be parsed

Single quotation mark'': indicates input, that is, output (WYSIWYG) reverse quotation mark ``: indicates that the command execution result is left behind, and is used for other command calls without quotation marks: it means that the function is similar to double quotation marks, but the sequence information {} can be recognized.

3) directional symbol series

Less than symbol: single less than symbol

< 标准输入重定向符号 将文件中小写字母替换成大写字母 将文件分为两个数一组 tr 'a-z' 'A-Z' < oldboy.txt (替换) xargs -n2 < oldboy01.txt (每行两组) 两个小于符号 >

Oldboy.txt error output redirection symbol

! [] (https://s1.51cto.com/images/blog/201912/22/b91966b2de4ca4c4d77612199d614f10.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)! [] (https://s1.51cto.com/images/blog/201912/22/706b70676d1d7834472f8eb1a38f84f3.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10, Yicheng 10 camera shadowboxes 90 typewriting ZmFuZ3poZW5naGVpdGk =)

Two greater than symbols > > standard output append redirect symbols

2 > error output append redirection symbol

Every two numbers as a group

4) path symbol series path information series single point symbol: find. / represents the current directory double point symbol: cd.. Indicates the parent directory wave symbol: cd ~ represents the user home directory information super user: / root ordinary user: / home/ user name dash symbol: cd-switch between two directories OLDPWD: save the path information before the user changes the directory 5) System logic symbol: &: the previous thing was executed successfully After executing the & & command | |: the execution of the previous thing failed, while executing | | the following command Regardless of whether the previous command is successful or not, the command after the semicolon will be executed

2. Introduction of system wildcard symbols.

A symbol that matches any information *

Match generated sequence information {} even series echo {00.. 10.. 2}

Odd series {00. 10. 2}

Combination sequence:

Echo A {, B}-> realize fast backup of data

Cp / oldboy/oldboy.txt {, .bak} An AB

Echo A {B,}-> to quickly restore data

Cp / oldboy/oldboy.txt {.bak,} AB A

3. The concept of regular symbols

1) regular symbols are mainly used to match character information.

2) regular symbols mainly match file content information

The main matching of wildcard symbols is the file name.

3) regular symbols can only be recognized by three swordsman commands

Grep sfd awk

4) regular symbols can be used to analyze data

Basic regular symbol:

Basic regular symbol: basic regular expression BRE

^: match the information that starts with

$: matches the information that ends with

Add: how to check if there is a space after a line

Method 1:

Cat-A file information

Method 2:

Vim file information-set list

^ $- match blank line information

Grep-v "^ $" / etc/selinux/config-use v to reverse, excluding blank line display

Exclude blank lines

"grep-v ^ $- matches information that removes blank lines"

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

Servers

Wechat

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

12
Report