The For loop syntax is structured as follows [[email protected] tmp]# cat 1 . sh # !/bin/bash for i in ' Seq 3 " do echo $i done [[email protected] tmp]# sh 1 . sh 1 2 3 Bulk Modify file name [email protected] tmp]# ll
1> file Comparison:-d filename checks if filename exists and is a directory-e filename checks if filename exists-F filename checks if filename exists and is a file-r filename checks if filename exists and is readable-s filename Check if filenmae
First, if else1.1, ifIf statement syntax format:if condition Then command1 command2 ... fiWrite a line (for the terminal command prompt):if [$ (PSgrep"ssh"1thenecho" True"fiAt the end of the fi is if the upside-down spelling, and later
The execution name of this program $n the nth parameter value of the program, n=1..9$* all parameters of the program, which can be more than 9 parameters. $# the number of parameters for this program $$ the PID of the program (the current number
What is a scrapy shell?The Scrapy terminal is an interactive terminal that allows us to try and debug the code without starting the spider, or to test XPath or CSS expressions to see how they work and to easily crawl the data in the page.Selector
1. Two methods of setting login prompt(1)/ETC/MOTD[[email protected] thzzc]# echo this is THZZC test Linux >/ETC/MOTD[Email protected] thzzc]# CAT/ETC/MOTDThis is THZZC test Linux(2)/ETC/PROFILE.D[Email protected] home]# echo echo This is THZZC
Analyzing Nginx Access Logsawk ' {a[b[$1]++]}end{for (I=length (a); i>0;i--) for (j in B) if (b[j]==i) {c++;if (c ' Www.dwhd.org_nginx.logThe effect is as followsSort statistics in reverse orderCat Access.log| Sort| Uniq -c| Sort 1 -n-rUniq only the
The Linux shell can be user-defined functions and can be called casually in shell scripts. Shell functions exist in memory, not hard disk files, so it's fast, and the shell can preprocess functions, so the function starts faster than the script.Note:
1, SH and./The Difference[email protected] ~]# cat test.shEcho I am thzzc1994[Email protected] ~]# sh test.shI am thzzc1994[Email protected] ~]# bash test.shI am thzzc1994[Email protected] ~]#./test.sh-bash:./test.sh: Insufficient permissionsWant to
For In loop statement#!/bin/bashfor x in one three Fourdo echo number $xdoneExample: Remove each line in the passwd name and output Hello + name#!/bin/bashlines= ' Wc-l/home/eko/passwd | Cut-d '-f1 ' for I in ' seq 1 $LINES ' Do echo '
Odd number of LikesLife is not as good as the ten, but there are no two or three people with the prophets. Fortunately, we were born in the internet era, the reality can not find to talk to people can also be found in the network of emotional vent,
Deny remote illegal users with SSH brute force login server. Once you enter the password error four times, directly deny the host IP login.The script is as follows:
#!/bin/bash#auto Deny SSH error IP#author is Lingshu#2018-04-30#########
Learning Environment: Ubuntu How to view the system version: [# Cat/proc/version]1. For loop Practice 1.1 batch generate random character file name caseExperimental purpose: Generate 10 randomly generated txt text under the/learning path, and the
Introduction of distribution System
When the business is bigger, the server needs more and more, a few servers is a bit better, when more than 10, dozens of, the workload is very large! And not specification, need a template machine to
8.6 Pipe symbol and job controlPipe break: The data from the previous command to be output to the screen as the standard input of the latter commandJob Control: When you run a process, you can use CTRL + Z to pause it, then the FG (foreground)
First, Shell introduction1, the shell is a command interpreter, providing users and machines to interact, each user can have their own specific shell,2, CentOS7 default shell for bash, and Zsh,ksh they have the difference in detail,We can check if
8.1 Shell Introduction: Can be divided into interactive and batch processingInteractive: The user executes a command every input immediatelyBatch: The user writes the full shell script in advance, and the shell executes many commands of the script8.2
Hello everyone, I am the lone cloud twilight rain, brought to you today is the "Linux shell script several circular statements to create the user's method"Add USER1~USER20 UserFor loop:#!/bin/bashfor i in {1..20}douseradd User$iecho ' user$i Users
I. Historical order History #查看历史命令 history-c #清空历史命令 history-w #不等退出, write the history command in the cache directly to the history command to save the file ~/.bash_history vim/etc/profile #默认历史命令保存1000条, can be modified histsize save the
Java real-time program in the process of occasional abnormal information interruption in the case, through the shell script to complete the self-boot.The following is a shell script that monitors a real-time Java program.Determine if the program 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.