OutFile is forbidden, or written files are intercepted;Operations in the database are as follows: (must be root permission)Show variables like '%general% '; # View Configuration Global general_log = on; # turn on general log mode Global
Cat Head Tail grep Sed awk Cut WC Sort Uniq TR TAC Rev Cat, Concatinate, connects the contents of one or more files sequentially, outputting them to the standard output.Cat 12.pub Cat-n 12.pub Cat-a file # Merging filesCat 12.pub 13.pub 14.pub
Tag: while void \ n Const floor How long def lengthTopicBriefly:
There is a shell of length n, divides it into several segments, gives the number of schemes divided into each length, and asks how many kinds of partitioning schemes
Test condition judgment# symbol [] equals test commandTen 5 # Judging the size of echo $? # View the previous sentence The test command returns the status "hello" # To determine if the string length is 0[$ 0"success" | |
I. Historical order History #查看历史命令 history-c #清空历史命令 history-w #不等退出, write the history command in the cache directly to the history command to save the file ~/.bash_history vim/etc/profile #默认历史命令保存1000条, can be modified histsize save the
In order to automate the receipt of file backup information from the server, the MUTT+MSMTP is used to send e-mail in the shell environment, which is an easy and efficient way to complete operations.Download MSMTPwget
1 exec BuiltinDo not create a child shell, start a new script on the original process, but it will clean up the environment of the old shell, so it does not inherit from the original shell, execute the new script in a clean environment. Exit the
1. Why use a functionLook at the role of aliases first[[email protected] ~]# alias httpd=‘/etc/init.d/httpd‘[[email protected] ~]# httpd start正在启动 httpd: [确定]function is to call the program multiple times the same code part is defined as a copy
Exit (0): Run the program normally and exit the program;Exit (1): Abnormal operation results in exiting the program;Exit 0 can tell the user of your program: Your program is finished properly. If exit is not a value of 0, then the user of your
Shell script advanced One, Shell script advanced condition test
When you write a shell script, you often need to judge some conditions, and you can use Test command test to help complete the test process. The test command tests whether a
Shell programming is actually a program that combines multiple commands, based on bash.Serious attentionThe difference between $hostname and $ (hostname)$hostname is to take the value of the hostname variable$ (hostname) is the execution result of
function definition Format:It's a bit like JS, but the function keyword is optional in the shell.Such as:sum{ //Shell statement} function sum () { //Shell statement}Function Call Method:Sum parameter 1 parameter 2 ... Get function Parameters:
1. Limitations of single-quote strings:
Any character in a single quotation mark is output as is, and the variable in the single-quote string is not valid;
Single quotation marks cannot appear in single quote strings (not after using escape
Exercise 1:Find patterns to print numbersRequirements: Please review the rules of the following numbers in detail and use the shell script to output the following 10 digits. 10 31 53 77 105 141 .....Hint: The difference between the two adjacent
Variables and environment variablesThe shell environment usually has many variables, and the variables can be viewed in the form of echo $VAR or ${var}. The SET command can view all variables in the current environment (including general custom
Batch Create 10 system accounts (OLDBOY01-OLDBOY10), and set the password (password is random number, the requirement is a mix of characters and numbers)To create a random password:#echo $RANDOM | Cut-c 3-9and write the user name and password to a
Routine maintenance requires a generic execution shell, but the CentOS 6 version is different from the 7 version of the command, and needs to be judged by the program itself, as follows:1. View cat/etc/centos-release[Email protected]/0 #
First, shell special symbol Cut commandA command that intercepts a field: cut-D: followed by delimited characters, separated by single quotation marks-C: followed by the first few characters-F: The next section is followed by the number of blocks-D
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