Useful Tail commands Manual in Linux

Tail Commands are used to print the last few lines of a file.
Available and popular switches can be used with tail with examples.

Simple tail command will list last 10 lines by default.
[root@server ~]# tail /etc/mainlog.log

Display last "N" lines only
[root@server ~]# tail -n 2 /etc/mainlog.log              (Display last 2 lines)

Display last 10 lines with refresh the output 
[root@server ~]# tail -f /etc/mainlog.log                (Will Refresh if the last lines modified)

Display last "N" Bytes only
[root@server ~]# tail -c 2 /etc/mainlog.log               (Display last 2 bytes)

Display last "N" KiloBytes only
[root@server ~]# tail -c 2K /etc/mainlog.log             (Display last 2 KB)

Display last "N" MegaBytes only
[root@server ~]# tail -c 2M /etc/mainlog.log             (Display last 2 MB)

Was this helpfull ?


Related Posts Plugin for WordPress, Blogger...

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons