Michael Stutz, author of the Linux Cookbook, has summed up 10 good habits with his many years of experience in using UNIX, and personally believes that it is really useful, and is summarized below to share with you.1. Create a hierarchy directory:
Thank you for the 36,000 sectionCommon Shell Categories:
BASH: is the GNU Bourne Again Shell, which is the default shell on the GNU operating system
C Shell: The BSD version of Sun's shell
Look at where the shell is on the
Overview What is a shell?The shell acts as an interface between the user and the Linux system, allowing the user to enter commands that need to be executed to the operating system. This is much like the command prompt for Windows, but the strong is
*-----Wildcard (multi-bit)?-----wildcard character (one bit)#-----Comment (Explanatory Note)\-----caret (\ #1. txt, let #1.txt become a file name, so that the special symbol behind the loss of meaning)|-----Give the result of one command to another
Tag: TR WC split cutCut interceptCut-d:-f+ number + file to take the first paragraph of the file, with a comma between multiple numbersCut-c intercept the first few characters (3-5 3 to 5)Sort sorts-T delimiter-U to repeat-N Sort by number-K
Basic format:Test expressionExpression constructed for the test command.Here expression is any valid expression that the test command can understand, and the simplified format will be the most common format that the reader may aiiowed seereturn
#!/bin/bashName="Matto" #变量名和等号之间不能有空格 #name="Blog4matto" #重定义name变量 #readonly name #设置name为只读变量 # unset name #删除变量, you cannot delete a read-only variable #${name}
1. Requirements backgroundFor large companies, there must be a site or configuration file updates from time to time, and the use of the machine is certainly a lot of units, less than a few, more than dozens of or even hundreds of sets. Therefore,
#输入输出重定向: Unix gets input from stdin by default, stdout output, input device is keyboard, output device is terminal#输出重定向: The clear output can be not only the monitor, but also the transfer to the file, which is called the output
I. Shell BasicsCat/etc/shells the shell that the current operating system can useWhat is a shell?A text file that implements a function that has permission to executeCommand-line InterpreterBuilt-in commands (commands provided internally by the
1, variable var from npos∈[0, Length-1] bit start, from left-to-right intercept num characters: ${var:npos:num}Summary: If NPOs If NPOs > Length (Var)-1 Then the result is an empty string;If the character does not actually meet the NUM bit, it is
1.shell Introduction
The shell is a special-function program that provides an interface for users to interact with the kernel. It is used to receive commands entered by the user and send it to the kernel for execution.
The shell is an
Use directly after declaring variables in the shell:#! /bin/bashNa=zhagnsanag=11Echo ' $na is $ag years old 'Output: $na is $ag years oldecho "$na is $ag years-old"Output: Zhagnsan is one years oldTherefore, use "" in shell scripts to output
#数组: Bash supports only one-dimensional arrays, starting with subscript 0.#定义数组: Array_name= (value0 value1 value2), as follows1 array_name=(2value03value14value2 5 )#还可以单独定义数组的各个分量, a continuous subscript may not be used, and the subscript range
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