为了节约空间,经常使用gzip压缩log文件:
比如:
boot.log 压缩之前大小为3824
-rw------- 1 root root 3824 May 8 10:07 boot.log
# gzip boot.log
压缩后大小为936
-rw------- 1 root root 936 May 8 10:07 boot.log.gz
很是节约空间,但是查看的时候如果解压后再查看,很容易把文件搞乱,可以直接使用zless 查看
[root@Meil log]# zless boot.log.gz
May 8 10:04:39 Meil syslog: syslogd startup succeeded
May 8 10:04:39 Meil syslog: klogd startup succeeded
May 8 10:04:39 Meil irqbalance: irqbalance startup succeeded
May 8 10:04:39 Meil portmap: portmap startup succeeded
May 8 10:04:39 Meil nfslock: rpc.statd startup succeeded
May 8 10:04:39 Meil rpcidmapd: rpc.idmapd startup succeeded
May 8 10:04:40 Meil netfs: Mounting other filesystems: succeeded
May 8 10:04:40 Meil autofs: automount startup succeeded
May 8 10:04:41 Meil smartd: smartd startup succeeded
May 8 18:03:54 Meil rc.sysinit: -e
May 8 18:03:56 Meil start_udev: Starting