Skip to main content
1 of 3
Dmitry Frank
  • 2.8k
  • 9
  • 29
  • 38

ssh: 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