:::: MENU ::::

How to capture results of a watch in a file

  • Feb 19 / 2015
  • 0
Linux

How to capture results of a watch in a file

For debugging purposes, it can sometimes be useful to write the results of a command executed at a given time lapse. You can easily monitor a command by using the watch command.

By default a watch command is only displaying result, and you have to be in front of to see the results. If you want to write them in a file with a timestamp, you can easily do it by using this command that combines  a watch command with tee:

You can now open your file /tmp/logfilewatch and see the results you just got!
For example, here is what you could get with my previous command, checking all the connections on port TCP 443:

Comments are closed.

Question ? Contact