Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

How can I tail -f a file that over the network, say at \\\public\print.log?

I have tried the variations of the following:

  • tail -f // which erred saying tail: cannot open `//' for reading: No such file or directory
  • Mounted the path using the mount -t cifs and then tried tail -f but that isn't working either, meaning it doesn't output the updates that are made to the file.
share|improve this question
What about if you do this over ssh? ssh username@my.server.com "tail -f /var/log/example/print.log" Is it an option to you to ssh to the other server? Since cifs is not a "panacea" to all file sharing issues, i would not trust it to export logfiles that require updates on-the-fly. – nwildner Dec 11 '13 at 13:14
@nwildner The other server hosting the file is not Linux, but Windows. And I'm lazy enough to open it's remote-shell ;). Plus that seems more of an overkill. – Bleeding Fingers Dec 12 '13 at 7:16
Then, I would suggest you the same as @jofel answer: Use watch to reload the last X lines of the file: watch tail // . The default is 2s on the watch command, and it can be changed with the -n parameter. :) – nwildner Dec 12 '13 at 10:46

Keep trying with mounted cifs. And just use tail with following parameter:

tail --retry --follow=name yourfile

Like this, tail follows the file name not the decriptor, and combined with --retry it tries again even if the file is inaccessible for some time.

share|improve this answer
Doesn't work. Not updating. – Bleeding Fingers Dec 12 '13 at 7:36

This seems to be a bug in the cifs kernel module. It could be that it is fixed in a newer kernel version than you use. Try the directio mount parameter to circumvent the bug (this could lower the filesystem perfomance heavily).

Using watch tail print.log could also be an solution. It displays the 10 last lines of the file every 2 seconds.

share|improve this answer

The smb protocol is archaic with a bunch of added on extensions. It was not designed to handle your workflow, and no one has added support for it. either use a hack like the --follow=name in gnu tail or a different protocol. I would be inclined to do the tail on the server and use netcat for network transport, unless the server is windows, in which case I would do some testing, or try to find another server.

share|improve this answer

In my case cache=none parameter helped.

I mount Windows share using this command:

sudo mount.cifs //IP_ADDRES/logs3 /tmp/logs3 -o user=user,password=pass,ro,nounix,iocharset=utf8,file_mode=0777,cache=none
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.