cat命令可以查看整个文件的内容。
[root@localhost hbk]# cat test.txt
hello world
my name is huangbaokang
I love you ,zhanglulu!
here just for test!
显示行号,-n参数
[root@localhost hbk]# cat -n test.txt
1 hello world
2 my name is huangbaokang
3 I love you ,zhanglulu!
4
5 here just for test!
只在有文本的行加上行号,跳过空行。-b参数
[root@localhost hbk]# cat -b test.txt
1 hello world
2 my name is huangbaokang
3 I love you ,zhanglulu!
4 here just for test!
cat的命令缺点是针对文本内容很长的情况,执行时一晃而过,不能进行分页查看,针对大文件,一般使用more命令或者less命令。