Linux to monitor network traffic script _linux 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

Code that determines whether a process exists in the Linux shell _linux Shell

1 matching names with Pgrep Copy Code code as follows: if test $ (pgrep-f $ | wc-l)-EQ 0 Then echo "process does not exist" Else echo "Existence process" Fi The following are supplementary content:Processes in the

Shell Script Learning Guide Text Processing tool _linux Shell

4.1 Sort Text Sort of 4.1.1 RowsWhen command-line options are not provided, the entire record is sorted according to the order defined by the current locale.In the traditional C locale, which is the ASCII order. 4.1.2 Sorted by FieldThe-K option

Five common Linux monitoring script code _linux Shell

1, view the host network card traffic Copy Code code as follows: #!/bin/bash #network #Mike. Xu While:; do   &nbs p;   time= ' Date +%m '-'%d ' '%k ': '%m '       day= ' date +%m '-'%d '        rx_before= '

Shell finds three ways to find files larger than 1M in the current directory share the _linux shell

1, using Find parameters to achieve Copy Code code as follows: [Root@xiaobb mnt]# Find. -maxdepth 1-size +1000000c ./sys.tar.gz ./install.tar.bz2 ./ctex_2.9.0.152_full.exe ./php-5.3.6.tar.gz [Root@xiaobb mnt]# LS-LH Total 1.3G

Bash for batch modification of file names (add, remove, modify suffix) _linux shell

First, add suffix 1. Problem: The same directory has a large amount of date-named files, some of which have suffixes, some end with the point, such as 20020101.,20020102.,......,20020101.td,20020102.td ...Requirements: Add all the suffix to the end

Linux and Windows automatic FTP script (shell bat) _linux shell

First, look at the Linux under: Copy Code code as follows: #! /bin/bash cd/ftp/ Currentdate= ' Date +%y%m%d ' Yesterday= ' date-d yesterday +%y%m%d ' Threedayago= ' date-d ' 3 days ago ' +%y%m%d ' #echo $TWODAYAGO Ftp-n-I 34.97.34.3

Shell for Loop and array application introduction _linux Shell

Reads a file, assigns each row to an array of variables, and prints it out with a for loop Copy Code code as follows: #!/bin/sh I=1 sum= ' sed-n ' $= ' tmp.txt ' #计算文件的总行数 echo "$SUM" While Read line Todo arr[$i]= "$line"

Find shell script code with the same name but different suffix file names in the directory _linux shell

Because the backstage input colleague, uploads the file the time, to file the same name, but different suffix name, because the file path is very deep, about 10 layers, each layer has dozens of files, so manually find a very troublesome, so write a

Find the shell script code for the specified suffix file in the specified directory _linux shell

Copy Code code as follows: #!bin/sh # Find the file for the specified suffix at the specified location, including subdirectories Usage # FINDF $ $ # The first parameter is a suffix # Find the file for the specified suffix and print it out

Shell code to prevent ARP attacks _linux shell

Copy Code code as follows: #!/bin/bash Declare gw= ' Route-n | Grep-e ' ^0.0.0.0 ' Declare gwname= ' echo $GW | Grep-oe ' \w*$ ' Declare gwip= ' echo $GW | Grep-oe ' [0-9]\{2,3\}\. [0-9]\{1,3\}\. [0-9]\{1,3\}\. [0-9]\{1,3\} '

The basic syntax and common judgment usage of if in the shell _linux shell

If, for, while almost all the keywords in all programming languages, in Shell programming is no exception, where if is the most frequently used, because shell programming does not exist in the concept of objects (object), so in the comparison of the

Linux Shell Script View numa information _linux Shell

The Nova provides NUMA-related advanced features under the NFV scenario, which provides a script to view the NUMA-related information for compute nodes. #!/bin/bash function Get_nr_processor () {grep ' ^processor '/proc/cpuinfo | wc-l}

Linux Shell Script Series Tutorial (vii): script Debugging _linux Shell

First, debug scripts Debugging is one of the important features that every programming language should implement, and when something unexpected happens, use it to generate the running information of the script, and the debugging information can

Shell Regular expression authentication IP address _linux shell

Multiple IP on this machine Copy Code code as follows: Ifconfig | awk '/inet/{print $} ' | Awk-f: ' {print $} ' First, use this first. Copy Code code as follows: Checkipaddress () { echo $ >/tmp/tmpserverip

Shell scripts periodically empty log files larger than 1G _linux shell

A question about how to automatically delete a specified file after it is larger than 1GB.The batch code is as follows: Copy Code code as follows: #!/bin/bash # when the/var/log/syslog is greater than 1GB # automatically back it up and

Linux gets Gmail's new mail via command line _linux Shell

Linux access to new Gmail Mail via command line without entering @gmail.com part #!/bin/bash num= "\033[1;36m" end= \033[0m " read-p" Enter your mail: "Name read-p" Enter Pass of Mail: " Pass atom= ' wget-qo-https://$name: $pass

Comparison of 3 methods of shell script passing parameters _linux Shell

#!/bin/bash #extracting command text_text_text_line options as Parameters Help_info () {echo "NAME" echo "\t$0" Ech O "Synopsis" echo "\t$0 is a shell test about process Options" echo "DESCRIPTION" echo "\toption like-a-B param1- C param2-d "} If [$#

A summary of the method of shell script passing parameters _linux Shell

svn

First, receive the fixed length of the parameter Copy Code code as follows: [Root@svn shell_example]# Cat params.sh #!/bin/bash #传参测试脚本 echo "My name is ' basename $ ' I ' called as $" echo "My I-parameter is: $" echo "My

Shell script reads 2 of a line in a file at a time _linux shell

Writing a: Copy Code code as follows: #!/bin/bash While Read line Todo echo $line #这里可根据实际用途变化 Done Writing two: Copy Code code as follows: #!/bin/bash Cat Urfile | While Read line Todo Echo $line

Total Pages: 541 1 .... 256 257 258 259 260 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.