Linux Shell Advanced Batch processing

There is a ' batch ' file in DOS that writes multiple commands into a batch called. bat.In Linux, it can also be done, and more powerful, I write batch processing is in Ubuntu 12.04 LTSAll I have to do is move the pictures on the USB drive to the

Linux shell command

Cat/proc/meminfoCat/proc/cpuinfoIpcs-aIpcs-mIpcs-sIpcs-qMkdir-p name when the parent directory does not exist is to create itINFOCMP VT100Echo $TERMXtermKonsoleGetconf Long_bitArchRelease= ($ (Lsb_releaseCD-RZ szecho $PS 1Ls-f (after the directory

Redirection of Linux shell code blocks

Code block redirection refers to redirecting standard or standard output to a file within a block of code, or leaving the default state outside of a block of code, in other words, code block redirection refers to the redirection of standard input or

Linux Automated Format partitioning method (non-interactive, can be used for Shell scripting)

Automated Format Partitioning method ---- non-interactive --- available for scriptingTo give the user a hint first, let him select a partition to formatFor i in ' mount|grep '/dev/sdb ' |awk ' {print '} 'Dofuser–km $i; Umount $iDoneDD If=/dev/zero

Linux Shell Common Tips (10)

Twenty. To get the system run data through the pipeline Combination shell command :1. Output the 5 most memory-intensive commands in the current system:#1) Lists all the processes that are running on the current host through the PS command.#2) The

Shell scripts refresh data without line breaks

#! /Bin/bash While[1] Do A = $ (ifconfig eth0 | grep'Rx PAC'| Awk'{Print $2 }'| Awk-F:'{Print $ NF }') Echo-ne"$ A \ r"# Refresh data without line breaks Done Echo Parameter number:-N. Do not wrap the line at the end.-E

Shell programming (7) --- usage of SED

Sed: A stream editor or a row editor. Sed processing process: sed reads a row from the source file and places it in a temporary buffer zone. This buffer zone is called a mode space and uses the corresponding mode to process the mode space, the

Comments and assignments in Shell

1. Single line comment: # echo "Hello World"2. Multi-line comment:: Tar cvzf $ databak_dir $3 $ date '. SQL' using databak_dir%3%date'.tar.gz '> 2> & 1SCP export databak_dir%3%date'.tar.gz '[email protected] "":/DIR # transfers backup files to

Shell $ (), '', $ {}, $ (), and (())

Tag: $ {} ''$ () Shell $ (), ''For command replacement $ {} Is used to replace variables (the following content is from shell 13) (1). Definition of Variables         $ A=B        $ echo $AB When executing this command, the AB is regarded as a

Shell script parsing 10 (Exercise 4) ------ monitoring File

#! /Bin/bash # Determine whether the command line contains parameters with two file namesIf ["$1" = ""] | ["$2" = ""]ThenEcho "Please enter file name"Exit 1Fi # Determine whether the target file existsIf [-e $2]ThenEcho "the file already

Shell programming Basics

(1) it must start with the following line (the first line of the file must be placed ):#! /Bin/shSymbol #! The program used to tell the system to run the script. This example uses/bin/sh. After the editing is completed and saved, it is assumed that

Shell script parsing 9 (Exercise 3) ------ reverse output

#! /Bin/bash # Prompt user input Echo-n "Please enter number" Read N # Put the input value into Variable N SD = 0 REV = "" On = $ N # Save the value of Variable N to the variable on for later use Echo "you put number is $ N" While [$ n-GT 0]

Regular Expression in Shell

I. Regular Expression description · Concept: Describe data with common attributes with a string of characters · Note: when using regular expressions for matching, be sure to use the \ transfer symbol. · Format: A. grep [Option] 'regular expression'

Shell script execution and basic knowledge

After we grant the shell script execution permission, we can test the program. Assume that the shell script file is hello. Sh.In the/root directory. The following describes how to execute shell scripts on a terminal:1. Switch to the directory where

Tips for getting parameters from shell scripts

The problem is as follows: perform a loop based on the number of Script Parameters $ #, and output each parameter $1 $2 $3 in sequence ...... I have a loop variable I $ I. When I get this variable I is 1, I want to use this 1 and then call $1, that

Rotate the Shell Part Template

mul

Convex hull diameter Detailed description of convex hull diameter // Calculate the convex hull diameter. Input convex hull Ch. The number of vertices is N, which is arranged counterclockwise. The square of the output diameter Int rotating_calipers

Example of a shell with Parameters

#! /Bin/bash # program: # lzsh server log filter # History: #2014/07/01 Kom first release #2014/07/03 Kom remote and multi-Param support # Set pathpath =/bin:/sbin: /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin :~ /Binexport path # Set Script

Several bash shell examples

? Time when the file is read #! /Bin/bash For file in 'ls/root' Do Stat $ File> 1.txt Sed-n "7 P" 1.txt> 2.txt Usetime = awk-F ":" '{print $2}' 2.txt Echo "time =" $ File $ usetime Done ? The while statement that reads each row of a file. Cat afile |

Email Alert shell script

Note: you must first install an email server such as Postfix or Sendmail. 1. Apache #!/bin/bash#apache.shnc -w2 localhost 80 if[ $? -ne 0 ]thenecho "apache is down,please check" | mail [email protected] -s "apache is

Several bash shell examples

Time when the file is read #! /Bin/bash For file in 'ls/root' Do Stat $ file> 1.txt Sed-n "7 p" 1.txt> 2.txt Usetime = awk-F ":" '{print $2}' 2.txt Echo "time =" $ file $ usetime Done The while statement that reads each row of a file. Cat afile |

Total Pages: 541 1 .... 483 484 485 486 487 .... 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.