Facebook Twitter Instagram
    WiredRevolution.com
    • Home
    • About
    • Contact Us
    • Essential Linux Commands
    • Sitemap
    Facebook Twitter Instagram
    WiredRevolution.com
    commands

    Display the last part of a file with tail

    RyanBy RyanOctober 14, 2008Updated:October 14, 20081 Min Read
    Facebook Twitter Pinterest LinkedIn Reddit WhatsApp Email

    Similar to the head command which shows you the first few lines of a text file, the tail command lets you to quickly view the last few lines of a text file. It also supports a monitoring mode which displays ongoing changes within the file.

    The tail command syntax.

    tail [options] file 
    

    By default tail will show you the last 10 lines of a text file.

    $ tail textfile.txt
    

    You can change the number of lines displayed by adding ‘-n‘ option and adding the number of lines.

    $ tail -n 3 textfile.txt
    

    This will show the last 3 lines in the file.

    You can keep track of ongoing changes within the file by turning on monitoring mode with the ‘-f‘ option. It is especially helpful when you want to keep an eye on log files.

    $ tail -f /var/log/syslog
    

    As lines are appended to the log file they are also displayed by tail.

    You can exit the program by pressing Ctrl-C.

    Share. Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Email
    Previous ArticleSelect threading implementation using LD_ASSUME_KERNEL
    Next Article Display the first part of a file with head

    Related Posts

    View the status of a long emerge

    Download digital camera photos with gphoto2

    List all open files with lsof

    Most Commented
    March 12, 2009

    Fix blue tinted video in Ubuntu

    September 10, 2010

    Setup SSH access between VirtualBox Host and Guest VMs

    March 8, 2011

    Install GNOME Shell in Ubuntu 10.10 Maverick

    April 4, 2009

    Setup the PS3 Bluetooth Controller on Ubuntu

    October 22, 2008

    How to correctly use LD_LIBRARY_PATH

    Recent Comments
    • Execute command on linux virtual machine (or server) from windows commandline on Setup SSH access between VirtualBox Host and Guest VMs
    • Solved: How to SSH to a VirtualBox guest externally through a host? - Daily Developer Blog on Setup SSH access between VirtualBox Host and Guest VMs
    • How to SSH to a VirtualBox guest externally through a host? [closed] – Code D3 on Setup SSH access between VirtualBox Host and Guest VMs
    • How to copy and paste from VirtualBox? [duplicate] on Setup SSH access between VirtualBox Host and Guest VMs
    • Jackie Laguna on Fix OpenGL: ChoosePixelFormat SketchUp error in WINE
    © 2025 ThemeSphere. Designed by ThemeSphere.

    Type above and press Enter to search. Press Esc to cancel.