[root@oldboyboy tmp]# seq 15 >l.sh [root@oldboyboy tmp]# cat l.sh 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 [root@oldboyboy tmp]# head l.sh 1 2 3 4 5 6 7 8 9 10 [root@oldboyboy tmp]#
[root@oldboyboy tmp]# head -3 l.sh 1 2 3 [root@oldboyboy tmp]#
參數ide
[root@oldboyboy tmp]# cat o.txt hello ! my qq 123.
I am oldboy my qq 1234567
[root@oldboyboy tmp]# head -c 3 o.txt
hel
[root@oldboyboy tmp]# 日誌
* tail 從文件內容的末尾開始查看 tail -5 l.sh 查看文件末尾的最後5行
[root@oldboyboy tmp]# tail -5 l.sh
11
12
13
14
15
[root@oldboyboy tmp]# code
參數 -f 用來實時查看文件末尾的內容 tail -f l.sh 實時查看文件末尾的內容,經常使用來查看WEB的日誌文件
[root@oldboyboy tmp]# tail -f l.sh
6
7
8
9
10
11
12
13
14
15it
當文件的末尾有新的內容追加時,就會實時顯示在文件末尾。