cat 这个查看文件内容的
-A 显示文件的所有文件(包括字符)
-n 显示行号
tac 倒序查看文件内容,与cat相反
more 也是用来查看文件内容,但是不会像cat一样一下全部显示出来,他的显示方式为一屏一屏的显示,
(可使用空格键查看下一行或ctrl+b 可以往前看,内容查看完以后会自动结束命令的运行)
wc -l 可以查看文件的行数
[root@localhost ~]# wc -l anaconda-ks.cfg.1
51 anaconda-ks.cfg.1 显示改文件的行数
[root@localhost ~]# wc -l anaconda-ks.cfg.1
51 anaconda-ks.cfg.1
[root@localhost ~]# cat /etc/passwd >> anaconda-ks.cfg.1 这就是把/etc/passwd中的文件内容增加到anaconda-ks.cfg.1文件中去
[root@localhost ~]# cat /etc/passwd >> anaconda-ks.cfg.1
[root@localhost ~]# wc -l anaconda-ks.cfg.1
93 anaconda-ks.cfg.1
[root@localhost ~]# cat /etc/passwd >> anaconda-ks.cfg.1
[root@localhost ~]# cat /etc/passwd >> anaconda-ks.cfg.1
[root@localhost ~]# more anaconda-ks.cfg.1
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
此处省略....
head 查看文件的前 10行 (默认10行)
-n 数字 (指定查看文件的多少行)
tail 查看文件的尾部,最后 10行
-f 动态显示文件
-n 数字 显示文件以数字为单位的行数(头几行,为几行)
[root@localhost ~]# head anaconda-ks.cfg.1
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
[root@localhost ~]# head -n 2 anaconda-ks.cfg.1
#version=DEVEL
# System authorization information
[root@localhost ~]# tail -n 2 anaconda-ks.cfg.1
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
chrony:x:997:995::/var/lib/chrony:/sbin/nologin