Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a terminal output which I'd like to be available to several users

currently something like:

command > /var/logs

for the input, and:

watch tail -30 /var/logs

for the input terminals.

however this is undesirable because watch only polls as opposed to outputting when there is updates and tail doesn't allow scrollback.

share|improve this question
up vote 6 down vote accepted

Two problems you posit:

watch only polls as opposed to outputting when there are updates

tail -f does not poll. As of version 7.5 of GNU Coreutils, tail -f will use the Linux kernel's inotify interface to receive signals from the kernel indicating that the file has been modified. If you don't use GNU Coreutils, or use a version older than 7.5 for some reason, it will poll once per second. It probably also polls on non-Linux POSIX operating systems (BSD, Solaris, etc) but you would have to research it on a case-by-case basis: some of these OSes use GNU Coreutils but the kernel doesn't support inotify; some of them don't use GNU Coreutils to implement tail at all.

tail doesn't allow scrollback

The less command is specifically designed to buffer data from stdin (e.g. from the tail command) and allow you to scroll back and forth. The buffer is not unlimited, but you can use command line options to increase or decrease the buffer as well as modify how long the buffer is for back-scroll and forward-scroll.

So something like, maybe,

tail -f /var/logs | less

would allow you to keep a scrollback buffer of the logs without polling (tail just sits there idle consuming no CPU until the kernel tosses it a signal letting it know that the file has been modified).

If you need multiple users to be able to read from the same buffer, you could just run tail -f /var/logs within a screen session. My original answer didn't take into account that you want to run this so that multiple users can see the same log data at the same time. @Let_Me_Be mentioned screen and then it occurred to me that that's probably your best bet.

So putting my solution and @Let_Me_Be's solution together:

screen -mdS logview -- tail -f /var/logs

Warning: Untested. Please edit if it's wrong. But I think we're close on the trail to a proper solution here.

Now you just need to have screen in multi-user mode. This is a little complicated, so I'll let this site speak for itself. The gist is that you have to add multiuser on to your ~/.screenrc file. Also see the Common Problems at the bottom of that link.

Now, for users to view the log:

screen -rS logview

should do it.

share|improve this answer
Also, have a look at this question, apparently less has an option to wait for and display new data (just like tail -f). – terdon Aug 16 '12 at 13:49

You want a program like screen or tmux.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.