1.在root用户的主目录下创建两个目录分别为haha和hehe复制hehe目录到haha目录并重命名为apple。[rootlocalhost ~]# mkdir /root/haha[rootlocalhost ~]# mkdir /root/hehe[rootlocalhost ~]# cp -r /root/hehe /root/haha/apple2.将hehe目录移动到apple目录下在haha目录下创建一个普通文件为heihei.txt。[rootlocalhost ~]# mv /root/hehe /root/haha/apple[rootlocalhost ~]# touch /root/haha/heihei.txt3.在终端中显示当前系统时间时间格式为月日时[rootlocalhost ~]# date %m%d%k4.截取当前日期的年月日显示在文件A.txt 中[rootlocalhost ~]# echo date | cut -d -f1,2,3 A.txt5.用户配置/etc/passwd文件将34 字段分别截取出来写入文件UID和文件GID文件[rootlocalhost ~]#touch /root/UID[rootlocalhost ~]#touch /root/GID[rootlocalhost ~]# echo cut -d : -f3 /etc/passwd /root/UID[rootlocalhost ~]# echo cut -d : -f4 /etc/passwd /root/GID6.通过一句话在当前终端显示当前系统一共有多少用户[rootlocalhost ~]# wc -l /etc/passwd7、列出/etc/passwd文件中所有用户名:分割开每一行中第一个字段就是用户名[rootlocalhost ~]# cut -d : -f1 /etc/passwd8、将/etc/passwd中内容按照冒号隔开的第三个字符从大到小排序后输出所有内容[rootlocalhost ~]# echo sort -t : -k 3 -r /etc/passwd9、列出/etc/passwd中的第20行-25行内容[rootlocalhost ~]# more 20 /etc/passwd | head -n 510、切割出你的ip地址和mac地址[rootserver ~]# ip a | grep ens160 | grep inet | cut -d / -f1 | cut -d -f6[rootserver ~]# ip a | grep link/ether | cut -d -f611、通过:切割出/etc/passwd中的最后一个字段并进行重复内容的重复次数统计[rootlocalhost ~]# cut -d : -f7 /etc/passwd |uniq -c12、通过df -h显示文件系统使用情况过滤显示/ 系统现在剩余大小在终端提示用户当前/系统的剩余大小为xx [rootlocalhost ~]# echo 当前/系统的剩余大小为df -h | grep -v 可用 | tr -s | cut -d -f413、查找/var所有的日志文件*.log备份在自定义的日志目录下/logfile。[rootlocalhost ~]# find /var -name *.log[rootlocalhost ~]# mkdir -p /logfile[rootlocalhost ~]# cp find /var -name *.log /logfile14、将备份好的所有日志文件进行压缩格式为.gz 包名为all_log_backup.tar.gz。[rootlocalhost ~]# tar -cvf all_log_backup.tar.gz /logfile15、将压缩包中的文件解压到/root目录[rootlocalhost ~]# tar -xvf all_log_backup.tar.gz /root