I wrote one of these posts before, but because Ecvps went bankrupt, so I lost two months of data, that article was lost, but I also updated the script method, there will be content generation key chain and no content automatically randomly generated
Positional parameters can be moved left with the shift command. For example, shift 3 means that the original $ $ is now $ $, the original $ $ $ $ $ $ $ $ The shift command with no parameters is equal to shift 1.
Very useful UNIX command: shift. We
The original script:
The code is as follows
Copy Code
#!/bin/bashFile= "/root/newfile/"List= "/root/sqlbak"Ls-l $list/|awk ' {print $} ' |while read lineTodoCp-r $list/$line $fileDone
Modified script:
Character: 12345ABCDESplit into:12345ABCDE
Method
echo 12345ABCDE | Awk-f "' {for (i=1;i
echo 12345ABCDE | Sed ' s/./&n/g '
echo 12345ABCDE | Grep-po '. '
echo "12345ABCDE" | Fold-w1
And then
Please 1000! How many 0 are included in the
To view the script that the process occupies the swap partition
The command script is as follows:
The code is as follows
Copy Code
For i in ' Cd/proc;ls |grep "^[0-9]" |awk ' $ >100 ';d o awk '/swap:/{a=a+$2}end{print '
A date loop that is useful in processing some data that is stored by date. Especially testing and recording, deleting, reprocessing data. However, if you encounter a situation such as the span of a month, simply using a numerical cycle is not
for var inch List Do CommandsdoneIn each iteration, the variable var contains the current value in the list, the first iteration uses the first value in the list, and the second one uses the second value.In do and done, the $var variable
# **********************************************************************# Description of the Linux shell self-startup script #: # When we are doing the system, writing from the startup script is often the case, the following is a sample analysis. ##
The shell is the interface that the user interacts with the system, which is one of the basic ways. The standard shell is bash.Shell's Operation:
Show all used commands: history.
Execute a command that has been recently executed:!!。 The
Variable Description:$$ The PID of the shell itself (Pro CESSID) $! PID of the last background process run by the shell $? End code of the last command run (return value) $- Flag list set with the SET command $* All parameter lists.
The basic features of bash:Command completion:The shell program receives a request from the user to execute the command, and after the analysis is completed, the leftmost string is treated as a command;Command Lookup mechanism:Find internal commands;
Twenty. To get the system run data through the pipeline Combination shell command :1. Output the 5 most memory-intensive commands in the current system:#1) Lists all the processes that are running on the current host through the PS command.#2) The
[email protected] ~]# split [-BL] File PREFIXParameters:-B : Can be divided into the file size, can be added units, such as B, K, m, etc.;- L : Split by number of rows.Example:Example One: my/etc/termcap has more than 700 k, if want to divide into 30
Reference documents:Summary of Shell interception string methods in LinuxHow does [Linux] calculate string lengths in shell scripts?There are eight ways to intercept a string, mainly for the following methodsThere are a number of ways to intercept
Regular expressions
Used primarily for pattern split/match/Find and replace operations on strings.
Regular expressions and wildcard characters
Wildcard charactersThe difference between a regular and a wildcard:
A regular match string
Knowledge Points:1) Sleep: Used to implement the delay function in the script, sleep N, delay n seconds2) Tput: Change the terminal display characteristics, common usage is as follows:Tput lines: Displays the number of lines of the terminalTput cols:
Technorati tag: Shell,df,sed,awk -Monitor System statistics
Monitor disk free space
Disk Resource Usage
Monitor CPU and Memory usage
-Perform a backup
Archive data files
Offline Storage of Backup files
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