快速学习-Linux文档的查看指令

3、文档的查看指令

3.1、tail指令

作用:查看一个文件的末n行
语法:#tail -n 文件的路径
说明:-n可以不写,不写,默认表示10行。
案例:使用tail指令查看root/install.log文件的末5行和末10行

# tail -5 /root/install.log
# tail /root/install.log

在这里插入图片描述

3.2、head指令

作用:查看文件的头n行
语法:#head -n 文件的路径
注意:如果不指定-n则默认头10行

案例:使用head指令查看root/install.log文件的头5行和头10行

# head -5 /root/install.log
# head /root/install.log

在这里插入图片描述

3.3、cat指令(重点)

作用:查看某个文件的全部内容(将内容全部输出在命令行中)【正序】
语法:#cat 文件路径1 文件路径2 文件路径3 …
案例:使用cat指令输出install.log文件内容

#cat /root/install.log

3.4、tac指令

作用:查看某个文件的全部内容(倒序的)
语法:#tac 文件路径1 文件路径2 文件路径3…
案例:使用tac指令输出install.log文件内容

#tac /root/install.log

3.5、vim指令

作用:打开一个文件,显示内容
语法:#vim 文件路径

例如:打开/root/install.log

#vim /root/install.log

退出输入“:q”按下回车即可。

发布了1951 篇原创文章 · 获赞 2068 · 访问量 18万+

猜你喜欢

转载自blog.csdn.net/weixin_42528266/article/details/105147132
今日推荐