#PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

hostnamectl set-hostname "修改主机名称:"

systemctl stop firewalld NetworkManager

systemctl disable firewalld NetworkManager

echo '* - nofile 65535' >> /etc/security/limits.conf

sed -i '/^SELINUX=/c SELINUX=disabled' /etc/selinux/config #关闭selinx

sed -ri 's#(.*UseDNS.*)#\1\nUseDNS no#g' /etc/ssh/sshd_config

mkdir -p /tmp/yum.repo/; mv /etc/yum.repos.d/* /tmp/yum.repo/

curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum -y install bash-completion net-tools lrzsz sshd vim wget zip uzip tree expect #安装基础软件 1

yum install -y bash-completion vim lrzsz wget expect net-tools nc nmap tree dos2unix htop iftop iotop unzip telnet psmisc nethogs glances bc #基础软件2

echo 'PS1="\[\e[01;31m\][\[\e[01;34m\]\u\[\e[01;32m\]@\h \[\e[01;35m\]\W\[\e[01;33m\]]\\$\[\e[0m\]"' >> /etc/profile ; source /etc/profile

read -p "输入IP末尾:" IP

w_IP=10.0.0.$IP

n_IP=172.16.1.$IP

sed -i "/^IPADDR/c IPADDR="$w_IP /etc/sysconfig/network-scripts/ifcfg-eth0

sed -i "/^IPADDR/c IPADDR="$n_IP /etc/sysconfig/network-scripts/ifcfg-eth1

echo "$w_IP $n_IP"

echo "正在重启"

init 6

grep -H 在匹配到结果左边显示文件名

grep -r 多级目录匹配