I have executed

>> watch tree ./

Now my problem is I'm unable to exit from watch - without closing the terminal.

I read man page of watch but they have not mentioned how to exit from watch screen.

Is there is magic key combo that you need to use to exit from watch ?

It's like one those problems you face when you for the first time open vim and don't know how to close it.

  • 1
    Watch works like tail -f, a command to inspect realtime logfiles, for example: sudo tail -f /var/log/syslog. It will not end, unless you type Ctrl-C – Redbob Sep 25 '17 at 18:57

Press Ctrl-C to interrupt watch. Ctrl-C is the general key combination to kill the foreground process in the shell. If that fails (it sometimes does for hung processes), pressing Ctrl-Z and issuing kill -9 %1to kill process number one works.

If you press Ctrl-Z you can do more things:

  • Resume the job to foreground by running fg
  • Resume the job in the background running bg
  • List running jobs using jobs
  • Manipulate the job, as mentioned, using kill
  • Change priority of job using renice
  • Start new jobs, leaving the old running in the background
  • okay, this works. But did the watch developers not give way to exit from it, like what we have key - q for exiting from htop/top. I was looking for something like that. – jaggi Sep 25 '17 at 18:47
  • It does say: By default, watch will run until interrupted. This is unix-ese for ending it with Ctrl-C :) – vidarlo Sep 25 '17 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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