# scripts are only for Exchange learning and use!
# The current version of the script is 1.0. Implements the creation of physical volumes, removing, changing (enabling/disabling assignments), scanning, viewing features.
# The following will
If you are an IT person accustomed to a Windows command prompt, you will feel overwhelmed when you first use the Linux command line. You are familiar with DOS commands that are basically non-existent in Linux. In front of you is a lot of orders to
Invoking awk in a shell script is very natural and simple, and if you need to invoke the shell script/command, you need to use the system () function, which is written as System ("sh my.sh" $var) if you need to pass the variable to the called Shell.
I looked at the/proc/net/dev under Linux to record the number of packets and bytes sent and received by each network card. So initiation thought, wrote one. Operation Effect:
Copy Code code as follows:
[root@74-82-173-217
Download a single file and print the output to standard output (STDOUT) by default
Curl http://www.centos.org
Save the downloaded file to the specified file by using the-o/-o option:
-O: Save the file as a file name specified in the
1, File type introductionLinux systems mainly include the following seven types of files: D directory-normal file L Symbolic link s socket file B block device file c character device file p named pipe file
2, Regular expressionRegular expressions
This paper introduces several common Linux monitoring scripts, which can realize the automatic monitoring and alarming of host network card traffic, system condition, host disk space, CPU and memory usage. According to their own needs to write a
The "Swiss Army Knife" here refers to the work of a simple command that can complete a large chunk of code in other high-level languages.
The following content is a summary of the Joshua Levy on Quora's website:
Get the intersection, collection,
The shell also has a real debug mode. If there are errors in the script "Strangescript", you can debug this:
Sh-x Strangescript
This executes the script and displays the values of all the variables.
The shell also has a pattern that does not
In the Linux system for day-to-day operations or scripting, variables are more familiar with, but what are the types of variables, what is the difference in the specific usage? This paper is to share with you:
One, bash variable type:
Local
1. Send mail in command line mode
1.1 Installation SendEmail
2.2 Using SendEmail and examples
2. Command line mode of receiving mail
2.1 Installation Getmail4
2.2 Configuration Getmail4 and simple examples
2.3 Using Munpack to extract attachments
First, the common skills
Copy Code code as follows:
SSH User@server Bash #ssh到远程服务器执行一个脚本, this command avoids uploading scripts to a remote server
SSH User@host Cat/path/to/remotefile | Diff/path/to/localfile-
In a shell, you can pass arguments to a function when it is called. Inside the function body, the value of the parameter is obtained in the form of $n, for example, the first argument is represented, and the second argument is $ $ ...
Examples of
Ord functions are not provided directly in awk, so when you convert a character to a code, you need to implement it yourself
Copy Code code as follows:
awk ' begin{for (i = 0; i
This mainly constructs the data structure of
First, CPU information collection
1). Collect CPU Usage rate
Acquisition algorithm: collecting and calculating CPU total utilization or single kernel utilization through/proc/stat file. Taking cpu0 as an example, the algorithm is as follows:1. Cat/
#!/bin/bash
#-------------------------Haproxy Server Management Shell script------------------------------------------------
#Authors are from JC
#time: 2012-10-10
#QQ: 408822635
#from the region Beijng.china.
#-------------------------Haproxy
In the shell, if you need to switch users, and then run some commands as a specified user,
For example, you need to write a line of "Oracle_base=/oracle/app" to a. bash_profile file with an ORACLE user.
You can use the following statement
When analyzing a complex script, it is sometimes necessary to pause, in a segmented view, to be more clearSo the reference to some of the implementation, the current own use is such a son#add forDebug by ZqbfunctionGet_char () {Savedstty= ' Stty-g '
Use of the Let command[Email protected] shell]# i=2[[email protected] shell]# let i=i+8[Email protected] shell]# echo $i10[Email protected] shell]# i=i+8[Email protected] shell]# echo $i10+8[Email protected] shell]#It can be seen from the above that
One, arrayarray: is a data structure,data series, continuous multiple data, can be used to get related elements of the indexDeclaring an array:Declare-a arrayname # can not be declared in advanceInitialization assignment:arrayname= ("STRING1"
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