查看文件命令
cat:查看文件的所有內容(適合小的文件)
more:分頁查看文件
[root@localhost ~]# more install.log
按空格向下翻頁,按q退出
less:更強大的分頁查看文件
可是使用PgUp向上翻頁,PgDn向下翻頁
使用ctrt+f向下翻頁,ctrl+b向上翻頁
可以使用方向鍵上下鍵逐行翻頁
使用方向的左右鍵,左右翻屏
按q退出
查看頭命令
head查看文件頭
[root@localhost ~]# head install.log
-n 後面跟顯示的行數
[root@localhost ~]# head -n 20 install.log
tail查看文件尾
[root@localhost ~]# tail install.log
-n 後面跟顯示的行數
[root@localhost ~]# tail -n 30 install.log
-f:動態顯示
[root@localhost ~]# tail -f hello.txt
hello3
hello33
使用場景:動態顯示日誌
原文:https://blog.csdn.net/qq_37022150/article/details/79173135