I. Network management
Temporarily Modify network configuration
Modify IP Address
Ifconfig NIC name IP address
Modify DNS
vim/etc/resolv.conf: Modify nameserver DNS Address
#!/bin/bash# Create a link interface named Bond0 ip=$1gate=192.168.18.1eth1=eno1eth2=eno2#eth3=eno3#eth4=eno4modprobe bonding# Back up the NIC 1 file cp /etc/sysconfig/network-scripts/ifcfg-$ETH 1 ifcfg-$ETH 1.bak# Modify the NIC Profile
For example, the need to test a batch of IP in the work is still blocked, you need to write a simple script ping test.We need two machines,Virtual Host: centos6.7 systemLocal linux:centos6.5"Virtual Host"Remote to the host, add IP (Learn the script,
Parentheses ():1. The commands in parentheses will be executed in a new sub-shell order, so the variables in parentheses cannot be used by the rest of the script. Multiple commands in parentheses are separated by semicolons, and the last command can
The following features are required for this article: a folder that has a folder that is named by a numeric number requires the deletion of files other than the maximum encoding.Specific implementationGeneral idea: Loop through all the files in the
Shell scripting is a very important "program" in Linux.
What shell script?
A shell script is an executable statement that is designed ahead of time to complete a particular task's file.Shell scripts can be divided into interactive and
ENGINEER1.4Shell Script BasicsUnderstanding the shell environmentHow bash shells are usedInteractive:--manual intervention, high degree of intelligence----explain execution by article, low efficiencyNon-interactive:-Need to design in advance, the
Special variables$ A: The file name of the current script$num: Num is a number starting from 1, and $ is the first argument, and $ is the second argument, ${10} is the tenth argument$#: Number of arguments passed in the script$*: All positional
In the/etc/profile file, there is a script:if Then /etc/bash.bashrcfi What does "dot + space + file" mean here?1, if we want to execute a file, but this file is not executable, at this time we want to use chmod u+x file_name to make the file
In my resume, I wrote that I am familiar with common Linux commands and can do shell programming, so it is necessary to learn shell programming.Read the catalogue:
First, Shell and bash
II. structure and execution of shell scripts
The basics of the shellFirst, Bash has the following features:1. Record command history2. Command and file name completion3. AliasesAlias rm= ' Rm-i '4. Wildcard characters* 0 or more characters?? match one character5 Input and output
In this article we learned how to use and define variables. According to the urine sex, the general next is to learn the basic data types of operations.Yes, this is still a cliché to talk about this boring but must learn basic data types of
1. Testing the connectivity of the 192.168.4.0/24 entire network segment (while version)#!/bin/bash#author: The Adventures of Tintin (Jacob) #定义变量i控制循环次数, I cycle from 1, once per loop, I self plus 1, until I equals 254 loop exit # Ping An IP in
In the shell script, the color control is often used as followsFormat:" \033[Word background color; text color m string \033[0m"eg" \033[41;36m something here \033[0m"Where 41 of the position represents the background, 36 of the position is the
Who commandThe WHO command is to display the user information of the current login system, execute the WHO command to know which users are currently logged into the system, execute the WHO command separately to list the login account, the terminal
WedgeRecently like the script so learn a little bit and solidify yourself.Simple Log emptying note! This is a test environment that can be emptied freely.Cd/var/logCat/dev/null>messagesecho "Logs cleaned up."One, can vim a file name example
(1) The shell prints the pattern as shown.650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/07/9D/wKiom1nMh-ygSI1MAAAj5j4UcHs376.png-wh_500x0-wm_ 3-wmp_4-s_3715701053.png "title=" capture. PNG "alt=" Wkiom1nmh-ygsi1maaaj5j4uchs376.png-wh_50
by Francis_hao Sep 30,2017Photo from reference "1"This article was authored by Liu Yinghao and licensed under the Creative Commons Attribution-NonCommercial use-Share 3.0 Chinese mainland license agreement in the same way. Welcome reprint, please
Regular expressions for 4. shell Basics 4.1 Regular strings are a string of rules 4.1 grep 4.1.1 Format: grep [-cinrvabc] ' word ' filename 4.1.2 -c //count, indicating number of rows
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.