Skip to main content
2 of 3
edited title
Braiam
  • 36.9k
  • 29
  • 114
  • 176

How to terminate remotely called "tail -f" when connection is closed?

I just noticed that if I execute ssh user@remote_host tail -f /some/file , then tail -f /some/file keeps running on the remote_host even if ssh connection is closed!

So, after several connects and disconnects, number of running tail -f /some/file grows. How to actually terminate tail -f when ssh connection is closed?

Dmitry Frank
  • 2.8k
  • 9
  • 29
  • 38