第一题:
第二题
[root@localhost ~]# mkdir -p /opt/tmp
[root@localhost ~]# touch /opt/tmp/a.txt
[root@localhost ~]# tree /opt
/opt
└── tmp
└── a.txt
1 directory, 1 file
第三题:
(1)
创建newfile文件:
[root@localhost ~]# vi /tmp/newfile
(:wq退出)
首行输入日期:
[root@localhost ~]# date > /tmp/newfile
查看:
[root@localhost ~]# cat /tmp/newfile
2023年 03月 28日 星期二 22:37:06 CST
(2)
[root@localhost ~]# vim /tmp/newfile
输入::r /boot/grub2/grub.cfg内容读入
输入::wq保存退出
(3)
打开文件:
[root@localhost ~]# vim /tmp/newfile
输入::g/#/b删除#
输入::wq保存退出
(4)
打开文件:
[root@localhost ~]# vi /tmp/newfile
输入::set nu开启行号提示
输入::wq保存退出