4

I'm on Ubuntu.

Is it possible to open putty and watch as a log file updates right in terminal? Like if stdout would have been directed in terminal?

For example I have one application's stdout and stderr directed into a file and want to watch how my app is starting from another terminal.

2 Answers 2

8

If you want to follow a log file, you can use the famous:

$ tail -f /path/to/log/file
3
  • Damn forgot about tail :D ty again. Used it inside gltail.
    – Somebody
    Feb 25, 2012 at 15:27
  • @Beck: If you want to view the log while writing in the same terminal, you can use tee.
    – Khaled
    Feb 25, 2012 at 15:34
  • Perfect. For example if you have a homebrew installation of Apache httpd, you can open a terminal window and run tail -f /opt/homebrew/var/log/httpd/access_log then load a web page from that server and see all the http transactions in real time.
    – w0mbat
    Oct 27, 2023 at 19:24
6

In addition to tail -f, you can also use less with the +F parameter, which will allow you to keep track of new new input, but at the same time have access to all interactive functions of less, such as searching.

In some situations it is better to use tail -F (or less --follow-name) instead of tail -f. This assures that you continue following new input even if the file name changes. It is especially useful with some log-rotating software.

1
  • interesting, will check that out. have been thinking about such a feature...
    – Tom
    Feb 26, 2012 at 23:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .