Shell CPU Utilization Memory utilization

#!/bin/bashcpu_usage_idle= ' Top-b-N 1 | grep Cpu | awk ' {print $} ' | Cut-f 1-d "." ' Let cpu_usage=100-$cpu _usage_idlemem_total= ' awk '/memtotal/{total=$2}/memfree/{free=$2}end{print (total-free)/ 1024x768} '/proc/meminfo ' mem_usage= ' echo

Use the shell to find the largest file in a directory

This is a very interesting question, because as a shell rookie, I have no idea for the first time. I wonder why this kind of operation Linux actually does not have a direct command to implement such a query.Naturally, the first feeling is to use awk

Use shell commands to traverse directory and subdirectory files and output to text

"Input_dir" represents the current directory, "Output_file" represents the output file, you can make your own changes according to the situation,1#!/bin/Bash2 functionGetdir () {3 forElementinch`ls$1`4 Do 5dir_or_file=$1"/"$element6

The play says Shell programming

The importance of the shell is self-evident to every system adminstrator. Today Allah is here to talk about the acid and cool shell programming of those years.let's start with an entry-level programming example. By the way with the Dora of Allah's

Post a shell for reference

1#! /bin/Bash2deploy_path=$ (CD"$ (dirname"$0")";pwd)3ini_file= $DEPLOY _path'/cnedmp_etl.ini'4 . $INI _file5base_path=$ (CD"$ (dirname"$DEPLOY _path")";pwd)6main_path=$ (CD"$ (dirname"$BASE _path")";pwd)7Currrent_date= 'Date-U +\%y\%m\%d

Introduction to Linux Shell

What is a Linux Shell A shell is a user program, or an environment that is provided for the user to interact with the system.It is a language interpreter that executes commands that are read from a standard input device, has its own built-in shell

Automatically determine whether a user has a password in a shell script

in the recent completion of the teacher's assignments encountered how to let the shell script command automatically determine whether a user has set the password problem, although seemingly not a difficult problem, but in the process of

Linux Shell Basic Specification

Start specifying the script interpreter# !/bin/bash or #!/bin/sh Opening plus copyright information#Date: 2017-8-01 22:50#author:yang Qiang wei #Mail: [email protected] #Funtion: This is delete ... #version: 1.0 No Chinese comments in

Shell scripting monitors memory and sends messages

1. Prepare the tool to send the message:#!/usr/bin/python#-*-Coding:utf-8-*-Import SysImport SmtplibImport Email.mime.multipartImport Email.mime.textServer = ' smtp.163.com 'Port = ' 25 ' def sendmail (server,port,user,pwd,msg): SMTP = Smtplib.

Linux Shell Command-----VI

VIEditoris the standard for all UNIX and Linux systemsEditorThat it's powerful not inferior to any of the latest textEditor, here is simply a brief introduction to its usage and a small number of instructions. Because of any version of UNIX and

An obscure shell command

1. REDIRECT Symbol> Output redirected to a file or device overwriting the original file>! Output redirected to a file or device forcing overwriting of the original file>> output redirected to a file or device to append the original file2. Standard

Shell replace and remove line breaks

When we use the shell to process files, we often need to remove or add newline characters, the name of the problem is how to quickly replace it?We have such a file[email protected] working]# cat

Shell Regular expression (1)

First, what is the regularA regular is a way to describe a character or string by combining symbols with special meanings, called regular expressions. Or, the regular is the rule used to describe a class of things.Second, grep1. Parameters-N: Show

Shell Script case

1. Write a loop to ping the IP of the entire subnet. using the while loop#!/bin/bash ip=223 While ["$ip"-ne "239"]do ping 121.201.0. $ip-c1 && echo "121.201.0. $ip yes" >> Ip_list.txt | | echo "121.201.0. $ip No" >> ip_list.txt ((ip+=1)) doneuse for

Shell Learning Note

Tag:expr   bsp    Command    not   csharp    other   filename    line    awk    Shell Learning notemain= "/usr/local/" # Variable uppercase status= "$MAIN/status" # USD multibyte string is a reference variable value, while USD multibyte number

Some tips for Bash shell command logging and CentOS

Practical Tips for ①centos:First, press the CTRL+ALT+F2 can be switched from the graphical interface to the command line (Shell window), press CTRL+ALT+F1 can be switched from the command line to the graphical interface (if the installation of

Shell monitoring scripts, regardless of multi-user situation

#!/bin/bashcheckprocess () {if[" $"="" ]; Thenreturn 1fi process_num= ' Ps-ef | Grep" $"| Grep-v"grep"| WC-l 'if[$PROCESS _num-eq1 ]; Thenreturn 0 Else return 1fi} while[1] ; Do#输入进程名 Echo" $"; Echo" $"; Echo" $"; Checkprocess"

Some tips for getting a shell

Turn from: Some tips for getting a shell1. Upload asp asa jsp cer PHP aspx format of the Trojan, do not add a space or use IIS6.0 Parsing vulnerability, common format: 1.asp;1.jpg or 1.asp;. JPG or 1.asp;jpg2. Sometimes upload the image format of

Shell script-Predefined constants

The execution name of this program$n the nth parameter value of this program, n=1..9$* all parameters of this program, this option can have more than 9 parameters.$# the number of parameters for this program$$ the PID of this program (the current

Shell script (v) array

Usually write scripts are not used in several groups, temporarily first record the usage.#!/bin/Basharray1=(1 2 3 4 5) Array1_length=${#array1 [@]}Echo "array1 Length: ${array1_length}" forIteminch${array1[@]} Do Echo "Current item of array1:

Total Pages: 541 1 .... 351 352 353 354 355 .... 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.