Simply put, the shell is a file containing several lines of shell or Linux commands. For a large number of commands that are written and used more than once, you can save them using a separate file,For later use. Typically, shell scripts are
This script is used in the common shell syntax of the work, the trivial grammar together can help to deal with work, liberation of manpower.The main common shell knowledge points:
Determine if the parameters exist and determine the number
In the shell, $* and [email protected] respectively represent the following meanings:$ A: The name of the script itself$#: Number of positional parameters$*: All positional parameters will be treated as a string[Email protected]: Each positional
Example The difference between-E and-F is that-F stands for regular files (regular file), and-E represents all types of filesRefer to the following:-e filename true if filename exists-F filename True if filename is a regular file-L filename True
In determining the size of a value in addition to (()) can be used in the form of [] but can not use;, If statementif Judgment statement; ThenCommandFiIf,else statementsif Judgment statement; ThenCommandElseCommandFiIf Elif statementIf Judgment
When using Jenkins for integrated deployment, when we deploy the generated war packages, we often need to make some backups or suspend the operation of the server, which can be executed directly in Jenkins.1, first install the plug-in SSH Plugin 2
The shell is the interface that the user interacts with the system, which is one of the basic ways. The standard shell is bash.Shell's Operation:
Show all used commands: history.
Execute a command that has been recently executed:!!。 The
Shell Command CollectionCCat Zdd Browse the contents of a ZDD fileCat Zdd1 Zdd2 Browsing the contents of multiple filesCat-n ZDD Browse the contents of a file Zdd and display line numbersCD back to the start directory, that is, just logged into the
1 single quotation marksSingle quotation marks can be used to restore the literal meaning of characters, to implement the function of shielding metacharacters, single quotes must be used in pairs[Email protected]~]# echo ' $JAVA _home 'Special
2. character intercept commands2.1 Cut field Fetch command (grep fetch row, cut fetch column )(1) Cut command:#cut [options] File nameOption:-F Column Number: Extract the first few columns;-D delimiter: Splits columns by the specified delimiter,
1. Shell Overview1.1 Shell Introduction(1) The shell is a command-line interpreter that provides users with an interface system-level program that sends a request to the Linux kernel to run the program, allowing the user to start, suspend, stop, or
12. Sort commands for Rowssort:1. Sort command-line options:
Options
Describe
-T
Separators between fields
-F
Ignore case when sorting based on character
-K
Define
Globbing: File name wildcard (whole file name match, not part)Match pattern: metacharacters*: matches any character of any lengthpa*, *pa*, *pa, *p*a*PA, PAA, passwd?: matches any single characterPa??? PA, P?a, P?a?PA, PAA, passwd[]: matches any
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. String judgmentSTR1 = str2 When two strings have the same content, length is trueStr1! = str2 True when string str1 and str2 are not equal-N str1 True when the length of the string is greater than 0 (string non-null)-Z str1 True when the string
Bash basic features: command line expansion~: Automatically expands to the user's home directory, or the specified user's home directory;{}: A comma-delimited list of paths can be hosted and can be expanded to multiple paths;For example:/tmp/{a,b}
File expression-e filename true if filename exists-d filename If filename is a directory, true-F filename True if filename is a regular file-L filename True if filename is a symbolic link-r filename If filename is readable, true-W filename if
#!/bin/sh mypath= "/var/log/httpd/" myfile= "/var/log/httpd/access.log" #这里的-x parameter Judging $ Whether the MyPath exists and has enforceable permissions if [!-X ' $myPath]; then mkdir "$myPath" fi #这里的-D parameter to determine if
Inadvertently see the router inside there is a dynamic domain name, and later on-line a check that it is possible to establish a personal website, and then allow other users on the network to access their own servers, such as their own establishment
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