tail和head命令

[root@rhel7 ~]# cat rusky   --cat命令查看文件内容
line1
line2
line3
line4
line5
line6
line7
line8
line9
line10
[root@rhel7 ~]# tail -n 3 rusky  --查看最后3行内容
line8
line9
line10
[root@rhel7 ~]# tail -3 rusky    --同上,另一种写法 
line8
line9
line10
[root@rhel7 ~]# tail -3 n rusky    --不能写成这两种方式
tail: option used in invalid context -- 3
[root@rhel7 ~]# tail -3n rusky
tail: option used in invalid context -- 3
[root@rhel7 ~]# head -n 3 rusky   --查看前3行内容
line1
line2
line3
[root@rhel7 ~]# head -3 rusky   --同上,另一种写法
line1
line2
line3
原文地址:https://www.cnblogs.com/rusking/p/5590132.html