tail
Output appended data as the file grows:
tail -f /etc/httpd/logs/error_log
Compress
From View compressed .gz files without uncompressing using Z commands
To view compressed log files:
# -f compressed and uncompressed
zcat -f dmesg | more
# no need for -f
zless dmesg.1.gz
zmore dmesg.1.gz
# -i case insensitive
zgrep -i usb dmesg.1.gz | more
# diff
zcmp dmesg.1.gz dmesg.2.gz
zdiff dmesg.1.gz dmesg.2.gz | more
Last x Lines
Last 30 lines of catalina.out
:
tail -n30 /opt/tomcat5/logs/catalina.out
Long Lines
Tail a log file with long lines truncated:
tail -f logfile.log | cut -b 1-80
Also useful for looking at different parts of the line,
e.g. cut -b 50-100
shows columns 50 through 100.
Or even smarter, use tput cols
to tell you the width of the
terminal:
tail -f logfile.log | cut -b -$(tput cols)