GNU `watch` executes a program and shows its fullscreen output every 2 seconds.
Questions tagged [watch-command]
29 questions
79
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
- 100,643
- 105
- 254
- 328
64
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
- 31,573
- 49
- 159
- 281
14
votes
2 answers
Why doesn't the "watch" command work on an alias?
So I've 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
- 302
- 2
- 12
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,628
- 5
- 41
- 55
8
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
- 181
- 1
- 3
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
- 1
- 9
6
votes
2 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,289
- 24
- 71
- 90
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
- 39,392
- 12
- 115
- 163
5
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…
Registered User
- 9,521
- 14
- 53
- 85
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…
Rajesh Chaudhary
- 861
- 1
- 13
- 25
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…
Hayden Shore
- 41
- 5
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 …
Registered User
- 9,521
- 14
- 53
- 85
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…
Sergiy Kolodyazhnyy
- 103,293
- 19
- 273
- 492
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…
Mike V.D.C.
- 878
- 1
- 8
- 17
2
votes
1 answer
Is there a way to use 'watch' with -d argument so that showed changes have vanishing graphical effect and play submarine sound every refresh?
Is it possible to add those effects in normal terminal? Modified terminal? Code something from 'scratch' for fun? Play sound every 3 seconds and lower the intensity of cursor highlight smoothly over 3 seconds time.
new User
- 80
- 6