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
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
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
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
1, dirs1) Functiondisplays all records in the current directory stack (the dirs command with no parameters displays the records in the current directory stack)2) Syntax(1) format: dirs [-CLPV] [+n] [-n](2) Options-C Delete all records in the
Break: exit the loop body continue: ends this loop and enters the next loop.Special usage of while 1: While: dodone the above is an endless loop of while.Special while usage 2: While read linedodone Function: FunctionSyntax format: Method 1:
#! /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
1). Background:During cluster deployment, consistent configuration and environment settings are required. for Virtual Machine clusters, you can copy, copy, and restore cluster machines by using images. different from physical machine clusters, if
Since HDFS is a distributed file system for data access, operations on HDFS are basic operations on the file system, such as file creation, modification, deletion, and modification permissions, folder creation, deletion, and renaming. Pair
HDFS
#! /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]
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
Man Bash:
Special ParametersThe shell treats several parameters specially. These parameters mayOnly be referenced; assignment to them is not allowed.* Expands to the positional parameters, starting from one. WhenThe expansion occurs within double
I am often very lazy. The main solution to laziness is to use scripts for automatic execution. However, sometimes, for example, processing a piece of data has not been completed, and the next execution starts again, this is a problem. Let's see how
? 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 |
1. First, cut Apache logs by day
VI/etc/httpd/CONF/httpd. confErrorlog "| rotatelogs/var/log/httpd/% Y % m % derror_log 86400 480 ″Customlog "| rotatelogs/var/log/httpd/% Y % m % daccess_log 86400 480" combined
Ii. Restart Apache server
Service
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
In the shell command terminal, Ctrl + n is equivalent to the downward direction key, and Ctrl + p is equivalent to the upward direction key.
You can use them or the arrow keys in the Command terminal to quickly find historical commands. This is
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