SEARCH

How-To Geek

A "live" view of a logfile on Linux

This approach works for any linux operating system, including Ubuntu, and is probably most often used in conjunction with web development work.

tail -f /path/thefile.log

This will give you a scrolling view of the logfile. As new lines are added to the end, they will show up in your console screen.

For Ruby on Rails, for instance, you can view the development logfile by running the command from your project directory:

tail -f log/development.log

As with all linux apps, Ctrl+C will stop it.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 09/11/06

Comments (9)

  1. sven

    if your’re already in less and would like to trace the file:
    less /path/thefile.log
    Shift+F

    to stop_
    Ctrl+C
    q

  2. moe

    I’ve seen all of the tips you got for linux and dude it’s cool so i got something to help some new ubuntu users
    1.www.getdeb.net
    getdeb got some really cool programs all it takes is for you to find something you like and click download because it’s .deb file it’s easy to install, but what shuld you get,
    A.(Ubuntu Tweak) with this little easy to use you can do most of the things here on you’re website,
    for new ubuntu users who don’t know how to use the terminal and the config editor by useing ubuntu tweak you can add and remove things off the desk top like My Computer- Trash and alot more
    B.(Screenlets) even that screenlets come in ubuntu the version is older the one on getdeb is the latest it’s aloes is with all of there programs.
    C.( Avant Window Navigator) this nice thing here is a dock that apple can never beat, just like screenlets the version is old and by ading getdeb to you’re source list you can get applets that beat all of the other docks .
    2.(Flock) is an amazing web browser it’s just like firefox but you can do mutch more and it’s so easy to use. (i’m using it right now)
    3.(Alien Arena) i cant give a tip with no games that’s just wrong, alien arena is a cool 3d game it’s amazing
    4. if you’re to lazy to install of the things on getdeb.net here is a away to bring getdeb to you’re home for the next 500 years
    open your source list (system-administration-software source)
    a windows well open and but your password if it asked you for when the windows opens click on
    third-party software, on the bottom left corner click on +Add and add this source to it
    deb http://ubuntu.org.ua/ getdeb/
    now just click close and it will ask you to reload then open up the terminal in (Applications-accessories-terminal and type or past this
    sudo apt-get update && sudo apt-get upgrade
    now everything on getdeb.net that works on you’re ubuntu will be in synaptic package manger.

  3. blu

    moe please shut up!

    this: deb http://ubuntu.org.ua/ getdeb/
    doesn’t even exist ! please check your sources before telling us your crap. tkz

  4. Sharninder

    tail -f will work as long as the underlying file we’re trying to read doesn’t change. If you’re trying to read a link to a file and the original file (and thus the link) changes, tail -f will not work.

    For that reason, its better to use tail -F for such files as described above … or tail -f –retry

  5. lamapper

    for brand new users… the less command will help you look at log files that have been compressed (.gz).

    most logs are in /var/log/ unless otherwise specified in a configuration file somewhere. Logs you will want to check out include: auth.log; messages; syslog. Other interesting log files are user.log; kern.log; dmesg and daemon.log.

    cat messages
    cat syslog

    While the CAT command will work with those, it will not work with the files ending in the extension .gz

    For these rotated files, use less:

    less auth.log.1.gz (assuming it exists on your system.)
    less messages.1.qz
    less syslog.1.gz

    remember that GREP and AWK are powerful friends that you want to learn and will help you get exactly the information you need from any file on GNU/Linux. Remember GNU/Linux is all about files….and that is an understatement.

    last – a – shows you who logged in; when and when they logged out….

  6. christy

    how to configure mobile brodband on ubuntu 9.04 from scratch connects sometimes then fails to connect i think i am to use ppp0 but no sucsess

  7. noicedemon

    one good way is to run the tail in back ground.

    e.g. tail -f &

    that way window would be available for further use and tail would also be continued.

    Also lets face it, it would be fun ;)

  8. None

    @noicedemon: You can start it in the foreground (without &), ctrl-z to stop it, and then the bg command to put it in the background — if you decide to run it in the background later.

  9. jura12

    cat /var/log/messages | ccze -A | less -R

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!