Questions tagged [watch-command]

GNU watch executes a program and shows its fullscreen output every 2 seconds.

29 questions
92
votes
4 answers

using watch run 2 commands

I have to do watch two commands in the same terminal windows. I mean something like watch du -h filename.txt && df -h But its showing only one output. So what I am thinking is may be its not possible to use watch to run multiple commands on the…
Raja G
  • 105,327
  • 107
  • 262
  • 331
73
votes
1 answer

How can I watch the output that was filtered with grep?

I want to watch the changes of the output gsettings list-recursively|grep text-scal which is org.gnome.desktop.interface text-scaling-factor 1.0 com.canonical.Unity.Interface text-scale-factor 1.0 but if I try to watch it with watch gsettings…
rubo77
  • 34,024
  • 52
  • 172
  • 299
20
votes
2 answers

Why doesn't the "watch" command work on an alias?

I made my customized alias command and tried to use it with alias, but my alias was not recognized while concatenated with the watch command. So I tried to make a thread of it and fortunately, this one helped me out. But what is the reason for…
YoloWex
  • 360
12
votes
3 answers

Why don't git colours appear when using watch?

When running git status -sb I see: I want to watch (from procps-ng 3.3.3) a repository. The --color option is supposed to keep colours. Interestingly, it works with ls: $ watch --color "ls --color" Showing: However for git the colours…
Drew Noakes
  • 5,878
11
votes
3 answers

GNU watch without erasing previous outputs

gnu watch is a very useful tool for inspecting a program output: It executes the program and shows the output full-screen every 2 seconds. Sometimes, I don't want the previous output to be erased, but rather be printed line by line with a time…
Adam Matan
  • 12,919
9
votes
1 answer

watch cuts off ps aux output when piped

While working on a (Python) script which is of no consequence here, I have come across a very strange behavior involving watch and ps aux, when the latter is piped to something else. I have managed to reduce the issue down to a single line. When…
MrLemon
  • 191
6
votes
1 answer

Unable to exit from watch

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…
jaggi
  • 166
6
votes
2 answers

How to properly quote piped command for "watch"?

I want to keep an eye on a file as it is created. So I used this command ls -hal ./file |awk '{print $5}' which gives the size of the file I am looking for. I use awk because I don't need other stuff, just the file size. But I'm unable to use this…
5
votes
3 answers

`watch git log` with correct colors

I want to watch the output of git log --oneline --graph with all the colors and tried to adapt the solution from Why don't git colours appear when using watch?, but it just renders (nearly) the whole output in orange: Output using watch -c $ watch…
dessert
  • 40,956
5
votes
1 answer

"watch" command doesn't work on alias

watch command doesn't work for alias commands. Without alias: ➜ scrcpy git:(master) git -P branch * master ➜ scrcpy git:(master) watch git branch With alias ➜ scrcpy git:(master) which gb gb: aliased to git branch ➜ scrcpy git:(master) watch…
3
votes
2 answers

How do i get the watch command to monitor temps and MHz at the same time

I'm running Ubuntu server 16.04, that I SSH into. I am looking for a way to make the watch command monitor multiple things but running into a problem. I have a working function that monitors my CPU and GPU temps as follows. temps() { watch -d…
3
votes
1 answer

Why does the "watch" command starts two "watch" and a "sh" process?

When I tried to run watch ps command I got the following result: Every 2.0s: ps Thu Jul 31 14:06:45 2014 PID TTY TIME CMD 4329 pts/1 00:00:00 bash 4380 pts/1 00:00:00 watch 4381 pts/1 …
2
votes
1 answer

The watch command with shell not recognizing filenames

While trying watch bash -c 'du -h /etc/passwd && df -h' it appears that the path to file was completely ignored, and instead du -h ran through the current working directory. Same result was observed when I ran watch bash -c 'stat /etc/passwd && df…
2
votes
1 answer

`watch`, `tail`, `grep` combination in `byobu`'s `windows.tmux`

I am (re)writing my windows.tmux for my frequently used byobu sessions. Below is my precise requirement: I would like to have a tab (or window?) with a root prompt. (On start, it waits for the sudo passwd). I would like the second one to be split…
2
votes
1 answer

monitor syslog and print line without `pattern`

I would like to monitor my /var/log/syslog continuously. However while monitoring, I would like to avoid certain pattern(s) while monitoring. I am interested only in the last 15 (for example) lines. For the usual monitoring I use the command: watch…
1
2