一.
1.应用vi命令在/tmp文件夹下创建文件,文件名newfile。在newfile首行输入日期时间
[xiaopan@localhost ~]$ su
Password:
[root@localhost xiaopan]# cd /tmp
[root@localhost tmp]# vi newfile
回车键进入newfile,按i对文件进行编辑,然后在第一行输入时间日期
2.将/boot/grub2/grub.cfg文档的内容读入到newfile文档中(在日期的下一行即第2行)
在输入日期后按esc退出编辑模式,输入:进入末行模式
:r /boot/grub2/grub.cfg
3.查找文档中包含#号字符的行,将整行删除
同样esc退出,输入:
:g/#/d
4.开启VI的行号提示功能
esc退出,输入:
:set nu
二.
文件查看:查看newfile文件的第6行
[root@localhost tmp]# head -6 newfile|tail -1 newfile
三.
查找文件 /usr/share/xml/xml.xsd 中包含字符串 re 的所有行。将所有这些行的副本按原始顺序放在文件/root/files 中
[root@localhost /]# ls user
ls: cannot access 'user': No such file or directory
[root@localhost /]# cat user
cat: user: No such file or directory
[root@localhost /]# cat /user
cat: /user: No such file or directory
[root@localhost /]# ls /user
ls: cannot access '/user': No such file or directory
[root@localhost /]# cd /user
bash: cd: /user: No such file or directory
问题:这个user不知道为什么进不去