/12 /usr/bin/cp /etc /backup/etc-$(‘date +%Y-%m-%e-%H-%M’)
2、rpm包管理功能总结以及实例应用演示。
https://blog.51cto.com/13369003/2424347
3、yum的配置和使用总结以及yum私有仓库的创建。
https://blog.51cto.com/13369003/2424350
4、写一个脚本实现列出以下菜单给用户:
(1)disk:show disk info信息
(2)mem: show memory info信息
(3)cpu: show cpu info信息
(*)quit
[root@gumt data]#cat test.sh
#!/bin/bash
#****
#Author: Gumt
#Mail: 1902924129@qq.com
#Date: 2019-07-28
#FileName: test.sh
#Version: V1.0
#Description: The test script
#Copyright (C): 2019 All rights reserved
#****
cat<<EOF
(1)disk:show disk info信息
(2)mem:show memory info信息
(3)cpu:show cpu info信息
(*)quit
EOF
read -p "Your chioce: " option
if [[ "$option" == "disk" ]]; then
fdisk -l /dev/[sh]d[a-z]
elif [[ "$option" == "mem" ]]; then
free -m
elif [[ "$option" == "cpu" ]]; then
lscpu
else
echo "Unknow option."
exit 3
fi
5、sed用法总结并结合实例演示
https://blog.51cto.com/13369003/2424321
6、 用bash实现统计访问日志文件中状态码大于等于400的IP数量并排序
[root@gumt data]#cat ip_sort.sh
#!/bin/bash
#********************************************************************
#Author: Gumt
#Mail: 1902924129@qq.com
#Date: 2019-07-28
#FileName: ip_sort.sh
#Version: V1.0
#Description: The test script
#Copyright (C): 2019 All rights reserved
#********************************************************************
nginx_log=‘/usr/local/nginx/logs/mynginx.log‘
code_400_num=$(grep -o ‘[4|5][0-9][0-9]‘ ${nginx_log} | wc -l)
code_400_sort=$(grep ‘[4|5][0-9][0-9]‘ ${nginx_log} | sort)
echo $code_400_num
echo $code_400_sort
7、 使用自制的yum源安装ftp、openssh、curl、wget、tcpdump等软件包
[root@centos-7 ~]# mount -r /dev/cdrom /mnt/cdrom
[root@centos-7 ~]# cat /etc/yum.repos.d/base.repo
[base]
name=base1
baseurl=file:///mnt/cdrom
gpgcheck=0
enabled=1
[root@gumt ~]#yum -y install ftp
[root@centos-7 ~]# yum -y install openssh
[root@centos-7 ~]# yum -y install curl
[root@centos-7 ~]# yum -y install wget
[root@centos-7 ~]# yum -y install tcpdump
原文:https://blog.51cto.com/13369003/2424356