Tag Info

Hot answers tagged

22

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. ...


18

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


10

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: ...


7

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 ...


6

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 . ...


5

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.


3

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 ...


3

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 ...


2

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 ...


2

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


2

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 ...


2

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 ...


2

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/8.44.25.17/detail-2013*' & With some other implementations, you may have to call the shell manually: nohup watch -n1200 sh -c 'rm -rf ...


2

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


2

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).


1

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>"


1

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 ...


1

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