linux开发时查看日志的常用方式

说起查看文本:
大家很肯定有用过cat:一次查看所有内容,不过文本行数过多,不能全部显示

[root@VM-0-12-centos ~]# cat /etc/profile

less:查看长文本时候使用,可以翻页

[root@VM-0-12-centos ~]# less /etc/profile

head:查看文件开始,默认10行

[root@VM-0-12-centos ~]# head /etc/profile

tail:查看文件结尾,默认10行

[root@VM-0-12-centos ~]# tail /etc/profile

而对于tail也可以一直查看文件结尾,类似于top命令
用tail -f 用于实时查询linux下的日志文件

[root@VM-0-12-centos ~]# tail -f /var/log/tinyproxy/tinyproxy.log

猜你喜欢

转载自blog.csdn.net/qq_25905159/article/details/110056295