Linux-shell script command grep

[grep profile : ]grep is used to filter lines that contain specific charactersusage: grep ' pattern ' fileFor example: grep ' BBB ' aaa.txt--color # Search for the keyword BBB from the file Aaa.txt and highlight it.[Regular meta-character :

Analysis of Shell custom functions and parameter calls

I. define functions CopyCodeThe Code is as follows: function fname () { Statements; } OrCopy codeThe Code is as follows: fname (){Statements;} Ii. Call Functions You can call a function by using the function name:$ Fname; # execute a

Call Shell. Application simple functions in vbs

Set OS = Createobject ("wscript. Shell ") Set os0 = Createobject ("Shell. Application ") Do Input1 = inputbox ("Please select:" + CHR (13) + CHR (13) + _ "1. Minimize all windows" + CHR (13) + _ "2. Restore window status" + CHR (13) + _ "3. Uniform

Shell-written alarm count control and recovery sample code

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];

Linux SHELL if command parameter description

*-B returns true if the file exists and is a block file *-C returns true if the file exists and is a character file *-D returns true if pathname exists and is a directory *-E returns true if the file or directory specified by pathname exists.

How to modify the output result of linux shell (ui color)

The color of the text terminal can be generated using an ANSI unconventional character sequence. Example: Echo-e "\ 033 [44; 37; 5 m ME \ 033 [0 m COOL" The above command sets the background to blue, foreground white, blinking cursor, output

Common shortcut keys for linux shell commands

Ctrl + a switch to the command line Ctrl + e switch to the end of the command line Ctrl + l clear screen content Ctrl + u clear the content before cutting the cursor Ctrl + k cut the content after clearing the cursor Ctrl + y copy the content

Tips for searching processes using shell grep

When writing a Shell filter process, most people use grep to search for the specified process in the output result of ps aux. However, the grep process is also displayed, for example, the pptpd process, two matching items are displayed: Copy

Code used to determine whether a process exists in Linux Shell

1. Use pgrep to match the name Copy codeThe Code is as follows: if test $ (pgrep-f $1 | wc-l)-eq 0 Then Echo "the process does not exist" Else Echo "process" Fi The following is a supplement:Processes in the current system: Apple @ ubuntu :~ $

Linux Command Line and shell script programming book Richard Blum

First script file Copy codeThe Code is as follows :#! /Bin/bash Echo "This is my first bash code! " Exit 0 Redirection symbols and mathematical computationCopy codeThe Code is as follows :#! /Bin/bashEcho-n "The time and date are :"DateValue1 = 100 #

Two very detailed shell instance code

Two very detailed shell instances General programming steps Now let's discuss the general steps for writing a script. Any excellent script should have help and input parameters. And write a pseudo script (framework. sh) that contains the framework

Next day of linux Shell Study Notes

Variable Get local host name# Hostname Obtain the System Version Number# Uname-r Obtain CPU type Obtain the cpu operation frequencyCat/proc/cpuinfo Obtain memory usage# Free-m Obtain hard disk usage# Df Variable types and variable operations

Shell file test

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

Shell instance: ssh, scp password-free Login

I. Requirements It is often difficult to enter a password for different linux machines, such as ssh Login or scp file copying. You can generate a public key through ssh-keygen, establish a trusted channel between the two machines.II. Environment

Shell instance: ssh, scp password-free Login

I. Requirements It is often difficult to enter a password for different linux machines, such as ssh Login or scp file copying. You can generate a public key through ssh-keygen, establish a trusted channel between the two machines.II. Environment

[Shell script learning] shift command Learning

Location parameters can be usedShift command shifts left. For exampleShift 3 indicates the original$4 now becomes$1, the original$5 now becomes$2, etc. The original$1,$2,$3 discard,$0 is not moved. Without ParametersThe shift command is

Introduction to Linux Shell scripts

8.1 count disk usage 1. Disk Space is a limited resource. 2 df and du are important commands used in Linux to measure disk usage. df is short for disk free and du is short for disk usage. 3. Find the disk space occupied by a file (or multiple files):

Shell implements simple process monitoring (watchdog)

#! /Bin/bashNAME = javaNOP =/bin/trueDATE = $ (/bin/date + "% Y-% m-% d % H: % M: % S ") ps-ef | awk-F "" '{print $8, $2}' | grep ^ java>/dev/null 2> & 1 case "$? "In0) # It is running in this case so we do nothing. echo "$ NAME is running OK. relax.

Using screen to implement near-concurrent shell Remote Call and partial implementation

Assume that the same Command needs to be executed on multiple nodes (considering the uncertainty of the command). Generally, the for loop is used and the command can be directly called through ssh. For example, you need to view the root directory

Prevent ssh timeout caused by long running of shell scripts

In some scenarios with high security requirements, the ssh timeout period is preset by the Administrator. After a period of time, the ssh connection is automatically disconnected. In this case, if you execute the script through ssh and the script

Total Pages: 541 1 .... 446 447 448 449 450 .... 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.