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
1. At the command terminal to get root user rightsIn the terminal, enter:sudo passwd rootEnter new UNIX Password: (enter your password here)Retype new UNIX Password: (Determine the password you entered)Passwd:password updated successfullyLater, if
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
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 also
Part 1 simple common commands
1. Date command
2. Display calendar Cal
3. display the current directory pwd
4. Switch the current working directory
By default, the main directory of a Super User is/root, while that of a common user is the same
Preface:
Take notes on network-related knowledge, including IP address A/B/C classification, static address configuration/DNS configuration, and nic information viewing.
*) Division of A/B/C/D network addresses
IP address = network address + host
A variable is a memory space. When a variable is referenced by a variable name, it is called a named memory space.
To define a variable, assign a fixed memory space to the variable. assign a value to the variable, that is, fill the data in the
Script: the source program implemented by the command flow control mechanism based on the actual situation.
Script description:
1. Start with shebang, that is #! /Bin/bash. The path of the script interpreter is specified here. 2. Comments starting
Single branch if statement
If condition; then statement1 statement2fi
Dual-branch if statement
If judgment condition; then statement1 statement2 ...... Else statement3 statement4 ...... Fi
Multi-branch if statement
If condition 1; then statement1
BASH Shell has an extglob option. After the shell is enabled, five pattern matching operators can be identified to facilitate file matching.
Method:
Run shopt command: shopt-s extglob
Close method: shopt-u extglob
When this feature is enabled,
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
After a netizen watched the old boy's shell video today, he asked the following question:
650) This. width = 650; "Title =" snap17.jpg "alt =" wkiol1oz8i_gwllfaaetvavr46c745.jpg "src ="
Jiebao
Jiebao
Jiebao
Jiebao
Jiebao
This series of scripts has already opened a forum on GitHub. I name it "Easy shell" (Click here to enter ).
At present, you have added the scripts in the previous phases. More scripts will be added to
? 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 |
Tag: Shell
1. Search for all files larger than 500 mb in the current directory, write these file names to a text file, and count the number of files.
Find/-size + 500 m-type F | tee/root/file.txt | WC-l or find/-size + 50 m-exec ls
Alias LL = 'LS-al'Use_color = false# Set colorful PS1 only on colorful terminals.# Dircolors -- print-database uses its own built-in Database# Instead of using/etc/dir_colors. Try to use the external file# First to take advantage of user additions.
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
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 |
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.