linux查看文件和查看文件头和尾
1、ls:文件列表分屏显示
使用:【ls -l 目录 | more】
我们在浏览某些文件夹的时候,会发现里面有很多文件,这时可以分屏显示文件列表:指令类似more
[root@mode ~]# ls -l|more
¼Ġ7004
-rw------- 1 root root 989 2014-11-04 anaconda-ks.cfg
-rw-r--r-- 1 root root 2290 2014-11-09 CentOS-Base.repo.oldboy
drwxr-xr-x 21 root root 20480 2016-05-10 git-master
-rw-r--r-- 1 root root 7094105 2016-05-10 git-master.zip
-rw-r--r-- 1 root root 23171 2014-11-04 install.log
-rw-r--r-- 1 root root 0 2014-11-04 install.log.syslog

2、Head :查看文件头部【几行】
[root@mode ~]# head [-n number] 档案
参数:
-n :后面接数字,代表显示几行的意思
范例:
[root@mode ~]# head anaconda-ks.cfg
# 预设的情况中,显示前面十行!若要显示前 5行,就得要这样:
[root@mode ~]# head -n 5 /etc/man.config

3、Tail查看文件尾部
[root@mode ~]# tail [-n number] 档案
参数:
-n :后面接数菌八字,代表显示几行的意思
范例:
[root@mode ~]# tail anaconda-ks.cfg
# 预设的情况中,显示最帮块斤后陵扯的十行!若要显示最后的 5 行,就得要这样:
[root@mode ~]# tail -n 5 anaconda-ks.cfg
