1、复制/etc/profile至/tmp/目录,用查找替换命令删除/tmp/profile文件中的 行首的空白字符
cp /etc/profile /tmp/
2、在vim中设置tab缩进为4个字符
# .vimrcset etset ts=4
3、20分钟内通关vimtutor(可参考https://yyqing.me/post/2017/2...)
已通过
4、编写脚本 createuser.sh,实现如下性能:应用一个用户名做为参数,如果 指定参数的用户存在,就显示其存在,否则增加之;显示增加的用户的id号等信息
# createuser.shread -p "输出测试的用户名: " USERNAMEif `id $USERNAME &> /dev/null` ; then echo "用户存在, `id $USERNAME`"else useradd $USERNAME &> /dev/null PASSWD=`cat /dev/urandom | tr -cd [:alnum:]|head -c8` echo "用户名:$USERNAME 明码: $PASSWD" >> userinfo.txt chage -d 0 $USERNAME echo "用户已增加: `id $USERNAME`,明码: $PASSWD"fi
5、编写脚本 systeminfo.sh,显示以后主机零碎信息,包含:主机名,IPv4地址,操作系统版本,内核版本,CPU型号,内存大小,硬盘大小
systeminfo.sh
RED="\E[1;31m"GREEN="echo -e \E[1;32m"END="\E[0m"$GREEN-----------------------Host systeminfo-------------------------$ENDecho -e "HOSTNAME: $RED`hostname`$END"echo -e "IPADDR: $RED`ifconfig | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' |head -n1`$END"echo -e "OSVERSION: $RED`cat /etc/redhat-release `$END"echo -e "KERNAL: $RED`uname -r`$END"echo -e "CPU: $RED`lscpu |grep 'Model name' | tr -s ' '| cut -d: -f2`$END"echo -e "MEMORY: $RED`free -h | grep Mem|tr -s ' ' :|cut -d: -f2`$END"echo -e "DISK: $RED`lsblk |grep '^sd'|tr -s ' '| cut -d ' ' -f4`$END"$GREEN----------------------------------------------------------------$END
6、编写脚本disk.sh,显示以后硬盘分区中空间利用率最大的值
[root@localhost data]# cat disk.sh#!/bin/bash#echo -e `df -hT | grep -Eo '([0-9]{1,2}|100)%' | sort -n -r | tr -d