Hot answers tagged watch
There's no good way to do this in less. You can type F to keep reading at the end of a file (like tail -f). You can type :e and a file name to view a different file, but unfortunately, if you enter the name of the current file, less doesn't reload the file. If you're looking for an alternative to watch ls, here are a few: Modern file managers (e.g. ...
There is watch in cygwin. But it isn't installed by default. You need to install procps package to appear watch. (you can run cygwin installer again and it allows to install only the missed packages without reinstalling the whole cygwin) Instead of watch you can use simple cycle like: while true ; do check file ; sleep 2 ; done
I might be misunderstanding the question, but is there a reason you can't use this? tail -f /location/of/thefile | grep -i -E "foo|bar"
Shift+F will make less similar to tailf. That is, it gets refreshed if more data is appended to the file.
watch is great, but this is one of the things it can't do. You can use tail to show the latest entries: watch "ls -rtx dir/ | tail -n $(($LINES - 2))"
The purpose of watch is to show the results of a command full-screen and update continuously; if you're redirecting the output into a file and backgrounding it there's really no reason to use watch in the first place. If you want to just run a command over and over again with a delay (watch waits two seconds by default), you can use something like this: ...
I found this thread titled: Bug#225549: have watch monitor stderr. That thread is from 2008, but it looks like older versions don't support the watching of anything other than STDOUT. So we're limited to just STDOUT. As for visible there is a lot of language in the info watch and man watch that make me think your observation/assumption is correct. excerpt ...
I'm not sure about your motivations, but maybe this would be enough? while true; do sleep 2; cmd >>output.txt; done & Otherwise, please explain why you really need watch.
Depending on your implementation/version of watch, it may not start a shell to interpret a command line, but instead runs a command that takes as argument the arguments it received itself. So, in that case, if you need it to run a shell command line, you need to start a shell explicitly as in: watch sh -c 'find . | wc -l' See also the inotifywait -rm . ...
Add -t to your ssh. By default when you pass a command to ssh, it doesnt allocate a TTY on the remote host, so the application only has a basic STDOUT pipe to work with. ssh -t foobar 'watch -t -d -n 1 "netstat -veeantpo | grep 43597"'
It seems curl does print the progress stats only when stdout is not a terminal. (e.g. curl -I sandbox.dev|cat would give you these results, too) You can disable these, however. From the manpage -s/--silent Silent or quiet mode. Don't show progress meter or error messages. Makes Curl mute.
I've created a small program that does exactly what you want in python. Find it here, it's called pwatch.
Ok, so there are a few issues with your approach. You are exporting a function, which is not portable between shells. watch executes its commands with /bin/sh, which on your system is not bash. And whatever shell it is, it doesn't respect function exports, so you get the error. Secondly, you can change your command to something like watch bash -c 'func1', ...
Try: watch 'bash -c "diff <(pacman -Q) <(ssh kate \"pacman -Q\")"'
Contrast: $ watch -n 1 "echo $(date)" Every 1.0s: echo Sat Apr 27 03:10:50 CEST 2013 $ watch -n 1 'echo $(date)' Every 1.0s: echo $(date) What you've done is to run echo "($ls DirFlat |wc -l)*100/$FileNum"|bc and date, substitute the output of each command into the shell command watch -n 100 "echo $(…) % $(…)", and run that. You need to prevent the ...
Simply type: less +F filename This emulates pressing "F" within the editor.
The "F" key when running less will do a "follow" similar to tail -f, but I'm not sure if that will achieve what you're looking for here.
watch is in procps, so install 'procps' package.
When git status is run under watch, it is able to detect that its standard output is not a terminal, meaning it will not output colors if the color.status setting is set to auto. To force git status to always output colors (even under watch), set color.stats to always, e.g. git config color.status always to set the setting permanently, or as ...
Installed the ncurses package and then I get a clear screen on every run. Thank you rush. I ran mine as while true ; do clear; <command> <file> ; sleep 2 ; done such as while true ; do clear; grep ERROR server.log | tail -n 5 ; done
You can use watch from busybox: install the busybox package and then call it via busybox watch -n 14400 THE_COMMAND In opposite to the normal watch coming with the procps package, it works internal with seconds (and not with microseconds). But if you need such long periods, you should have at least a look at cron or at as Warren Young pointed out in ...
phpunit | cat didn't work unfortunately. However the bash script approach worked great. Thanks! #!/bin/bash while true; do (echo -en '\033[H' CMD="$@" bash -c "$CMD" | while read LINE; do echo -n "$LINE" echo -e '\033[0K' done echo -en '\033[J') | tac | tac ...
I expect it to exit if a file is added or removed I'm pretty sure you're after inotify-tools. My manpage for watch, from procps-ng, says watch runs command repeatedly, displaying its output and errors (the first screenfull).
You can use the -t switch to watch which causes it not to print header. However, that will still clear the screen so you might be better off with a simple shell loop: while sleep 1; do wc -l my.log done One of the advantages is, that you can easily add other commands (e.g. date) and/or pipe the output through sed to reformat it. By the way, if you ...
If using the watch command from procps (which starts a shell to interpret the command line that's made out of the concatenation of its arguments), use: nohup watch -n1200 'rm -rf /var/log/radius/radacct/18.104.22.168/detail-2013*' & With some other implementations, you may have to call the shell manually: nohup watch -n1200 sh -c 'rm -rf ...
Alternatively you can wrap it into a shell loop: while sleep 100; do (... your stuff ...) if [ (... process has finished ...) ]; then (... beep or get operator's attention otherwise ...) break fi done
You are right, your issue is the rendering of the beautification done by nroff/groff. To avoid this beautification, bypass nroff/groff and output your pod documentation into text with pod2text (this is a part of Perl distrib, so you should have it): watch "pod2text <your_perl_withpod_file>"
This particular point of contention has come up here on U&L a couple of times before. Mainly around the tool watch, which doesn't have this feature. How can I scroll within the output of my watch command? Is there a way to dynamically refresh the less command? Is there a paging version of watch? Generally you have 3 options. Use watch with this ...
You have to put this into a shell script and let watch call this script then.
From your comment you should be doing pgrep donothing.py or pgrep -x donothing.py. When using pgrep -f it looks for any command which has the matching string in it's name and/or arguments. There is no pretty way of filtering out results. The solution is to match exactly what you're after, so match the process name. pgrep by default matches just the process ...
Only top voted, non community-wiki answers of a minimum length are eligible