20. Use the shell command in the pipeline to obtain system running data:
1. output the five commands that occupy the most memory in the current system : #1) run the ps command to list all processes running on the current host. #2) The fifth
Replace file1 with the actual file as follows
1. query the row number of the empty row in file1.Grep-n "^ $" stl_stable_sort.ccRefer:Common grep commands
2. query the rows ending with ABC in file1.Grep-n "^. * ABC $"
1. find Find pathname-options [-print-Exec-OK] let's take a look at the parameters of this command: path of the Directory searched by the pathname find command. For example, use "." To represent the current directory, and use "/" to represent
My colleague asked me a question about awk today. It means that the several rows of data obtained through the awk operation are not fixed. You need to store the obtained rows of data in an array and do not want to use loops. After one afternoon's
This e-mail alert script is widely used. Many of the sendmail and postfix scripts are used, and some of them are used in perl's NET: SMTP and Authen: SASL modules, but I am not using perl well. I always send some inexplicable emails (such as if (a> 1
1. Methods of raw violence
Copy codeThe Code is as follows: myLinux:/home/zhanhailiang/public_html # killall nginx
2. gentle approachFind the pid of the specified process and kill | kill-USR1
Copy codeThe Code is as follows:
Bash shell supports only one-dimensional arrays, but there is no limit on the number of parameters.
Declare an array:Declare-a array(In fact, you don't need to declare it. You just need to assign values to variables in the array mode. BASH knows
Back up database shell script 1
Copy codeThe Code is as follows :#! /Bin/bash
# Specify the running script shell
# Run the script to grant the user the execution permission
Bakdir =/backup
Month = 'date + % m'
Day = 'date + % d'
Year = 'date + %
1. print some header informationCommand ............Dilimiter
Use the content in the demarcation symbol dilimiter as the standard input of the commandIt is often used in echo commands, which avoids the use of an echo command when no line is output,
3.1 search for textGrep: use the basic regular expression (BRE) defined by POSIX ).Egrep: use an extended regular expression (ERE ).Fgrep: Quick grep. Use an optimized algorithm to match a fixed string instead of a regular expression.
1992 POSIX
Copy codeThe Code is as follows :#! /Bin/bash
# This script is used for describle CPU Hard Memery Utilization
Total = 0
Idle = 0
System = 0
User = 0
Nice = 0
Mem = 0
Vmexec =/usr/bin/vmstat
Which sar>/dev/null 2> & 1
If [$? -Ne 0]
Then
Ver = 'vmstat-
I am also a newbie. I am a little old-fashioned. I am a good trainer. It is a reference for beginners.
Copy codeThe Code is as follows :#! /Bin/bash
If [$ succ_ping-gt $ (ping_count-1)]; then
If [-f./alarm_file/alarm _ $ host];
Copy codeThe Code is as follows :#! /Bin/bash
#********************************#
# Run fun in the concurrent background #
# For wanggy 2012-01-25 #
# Note :#
# Fun_num number of times the fun function runs in the background #
# SQL _num SQL
File Type:
-F: determines whether the file is a common file.-D: determines whether the directory is used.
-B: determines whether a device file is a block.-C: determines whether a device file is a dual-character device file.-S: Determine whether the
For is an important loop statement in shell programming:
Syntax 1:
For variable in list
Do
Action
.....
Done
List:
① 'Seq 1 10' #1-10
② {1 .. 10 }## 1-10
③/Etc/rc. d/rc3.d/K * # All files starting with K in the directory will be cycled once.
④
While Syntax:
While [condition]
Do
Command
........
Done
Special while usage:
① While true | while ;;
Do
Done ---------------------- endless loop
② While read line_value
Do
Done
Exercise:
Use the while statement to capture bash
Conditions are required for exporting data from mongodb
Currently, time is stored in milliseconds. Therefore, you must obtain the number of milliseconds from the shell.
The first thing to say is the + % s parameter of the date command.
I searched
Overview
Multiple duts are usually used during testing, saving a lot of time to upgrade the new version of the work script.Code
#! /Bin/bash # download new version, scp to dut and upgrade # author: godlaughing url = $1 wget $ url download_dir
I am a Shanghai Telecom ADSL Broadband User and use ZTE ADSL 831 MODEN to access the Internet.I am an old man and I don't want to know much about it technically. I just drew a gourd image. After two weeks of hard work, I initially set up my
1. Install the system patch of power shell V2.0 on the client. The patch number is KB968930, which includes winrm and powershell 2.0.
2. Set the view connection server to a trusted host of winrm:
Ps c: \ set-item wsman: \ localhost \ Client \
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