watch will execute a program periodically, displaying the output.

learn more… | top users | synonyms

0
votes
1answer
56 views

is it possible to monitor the /var/log/secure or /var/log/message using watch command

When I was trying to monitor the /var/log/secure or /var/log/message using watch command the output showed as /var/log/messages: Permission denied. Is it possible to monitor the /var/log/messages and /...
0
votes
1answer
51 views

How to stop a “watch” process

I use "Pleeease" to watch CSS files and automatically compile them when any change happens. I did pleeease watch and then just close the terminal, the wathcing process keeps running. Now I want to ...
5
votes
3answers
2k views

How to force watch to run under bash

The problem is that when watch is executed it runs sh and I get this error: sh: 1: func1: not found here is the code: #!/bin/bash func1(){ echo $1 } export -f func1 watch func1
69
votes
7answers
54k views

Is there a way to dynamically refresh the less command?

I like the watch command, but it has its limitations. I'm curious to know whether I could mimic the functionality of watch with less. I'm mainly looking for the ability to scroll through my directory ...
7
votes
5answers
8k views

Output of 'watch' command as a list

I want to do some simple computation of the number of lines per minute added to a log file. I want also to store the count for each second. What I need is the output of the following command as a ...
1
vote
1answer
76 views

How to start a command every 5 seconds on Solaris?

How to start a command for example ls -la every 5 seconds on Solaris ? . I'm searching for something like watch -n 5 ls -la
1
vote
2answers
53 views

Color output of linux command similar to 'watch -d' to highlight differences?

I'm at the beginning of shell scripting etc. and a bit challenged to find the proper way of colorzing a command's repeating output, similar to the -d option in the watch command. I want to see the ...
4
votes
2answers
312 views

How to wrap output of watch command?

Consider the following command: watch -d "ps -ef | grep java" It gives following output: kshitiz 11369 11285 0 Oct13 ? 00:06:02 /usr/lib/jvm/jdk1.7.0_40/jre/bin/java -Djava.awt.headless=...
11
votes
2answers
443 views

Why does `watch` make `ls /tmp` list contents of $HOME?

I'm trying to watch number of files in my /tmp/ directory. For this I thought this command would work: watch sh -c 'ls /tmp/|wc -l' But it appears to work as if ls had no arguments. Namely, I'm in ~...
3
votes
4answers
51 views

Is there a variant of watch that only refreshes upon receiving a signal?

I have a window that runs a somewhat expensive watch git log ... incantation — expensive enough that it actually looks more like watch -n30 timeout 10 git log ... so that it doesn't excessively ...
1
vote
1answer
64 views

Pretty print output of “kill -USR1”-ing dd

When dd is done it prints a three line summary about the number of read and written segments, the total size and average writing speed. While it does its work, dd is awfully quiet. Not too long ago (...
0
votes
1answer
87 views

Linux `watch` segmentation fault

When I try to use Linux watch with a command which returns color output, I get the error: segmentation fault (core dumped). The command itself is the following: watch --color --no-title --interval 1 ...
1
vote
1answer
58 views

Watch not showing subshell output

Why does the following not output "hello" line? watch bash -c 'echo hello' As this one? watch 'echo hello' I expected to have echo write to bash output directly and this to be read by watch and ...
1
vote
2answers
18 views

Watch: Only print to screen if output has changed since last output

I'm running a process and I'm counting the number of threads with ps huH p <PID_OF_U_PROCESS> | wc -l I can run this thread with watch like this; watch -n 1 ps huH p <PID_OF_U_PROCESS> |...
0
votes
2answers
82 views

watch not displaying output of script

I have a simple script which just uses awk to extract some information from output of ps. When I run this on the terminal, it works fine. But, when I run this script with watch: watch bench_run.sh ...
9
votes
3answers
510 views

Perform command every X seconds

I wish to perform a command ever 10 seconds, and have it executed in the background (thereby eliminating watch?). All the answers show something like the following, but this will execute ever 11 to ...
1
vote
1answer
76 views

Run multiple commands in watch

I have a small script, that I want to constantly run until I Ctrl+C. I saw a few suggestions of using watch, and the small examples I've seen work fine, but I can't get it to work for me. Here's my ...
2
votes
2answers
496 views

Get a refreshing list of running specific processes

I want to monitor running python processes with VSZ, RSS %MEM, %CPU etc. One of my priorities is a list refreshing every X seconds. I managed to come to the point of obtaining a refreshing list of ...
2
votes
1answer
346 views

Using ps and watch to observe parent and child process

I got a parent and a child process running, I know their IDs. How do I utilize 'ps' and 'watch' to filter them out, so that I can see their used CPU times? I tried 'watch ps -u USERNAME', but as you ...
3
votes
2answers
214 views

Can not evoke watch command with non-integer time option

I want to start the w command periodically, according to man watch the smallest possible time interval is 0.1. I tried: watch -n1 w (works) watch -n1.5 w (does not work) watch -n0.1 w ...
4
votes
1answer
376 views

How to perform the watch command onto expression with pipes?

I learned today the wonderful shuf command: ls | shuf shows me a listing of the working direcotry, but thanks to shuf each time I execute this piped command expression with another order. So I ...
9
votes
2answers
2k views

Alternative to watch which support colors

I have a command (phpunit) which has a colored output. According to the watch, command I should be able to use the --color flag to allow color rendering to pass through. However, this isn't working. ...
2
votes
0answers
575 views

Highlight differences between two files, similar to what watch -d produces

The command watch -d produces a very interesting diff: it shows the most recent iteration of the command, and highlights (with inverse video) the differences to the previous iteration. This works ...
11
votes
3answers
1k views

watch command smallest -n interval

What is the smallest interval for the watch command? The man page and Google searches do not indicate what the smallest interval lower limit is. I found through experimentation it can be smaller ...
2
votes
3answers
233 views

Running a timed background job in bash

I would like to execute a command in bash every 30 seconds and have it run as a background job. Form this post, I gather that using the watch command is useful. However every time I attempt to ...
3
votes
3answers
328 views

How to mask passwords in 'watch' command?

I am using watch to monitor the progress of a MySQL replication slave. The way I have it set up now, the password shows up in the header of the watch output. I am not exceedingly worried that someone ...
8
votes
5answers
6k views

How can I run `watch` as a background job?

When I run: watch 'cmd >> output.txt' & the job gets suspended by the system: 3569 Stopped (tty output) Is there a workaround?
1
vote
2answers
94 views

watch perldoc output preserving formatting

When I use watch to follow a perlpod documentation i am writing, the formatting gets mangeled (see NAME and Synopsis sections): Every 2,0s: perldoc lib/Uki/Handlers/SOS.pm ...
23
votes
4answers
8k views

Cygwin has no watch command?

I installed Cygwin on my Windows XP to use some of its commands. Now I what to check a file every 2 minutes and want to use watch for this purpose but I see that Cygwin has no such command. Is this ...
1
vote
1answer
656 views

Repeating a text-output terminal command, in a scrollable ncurses-like interface?

man ps says: If you want a repetitive update of the selection and the displayed information, use top(1) instead. ... however, in some cases, I don't like the output of top - I would instead like ...
24
votes
2answers
4k views

How can I scroll within the output of my watch command?

I use the watch command to see the contents of my directory changing as a script runs on it (via watch ls dir/) It's a great tool, except that I can't seem to scroll down or up to see all of the ...
12
votes
2answers
407 views

Does watch only monitor the visible output?

Does watch only monitor the visible output of a command? Say I'm in a directory with the following contents: $ ls a b c d e f g h i j k l m n If I run watch -g ls -1 I expect it to ...
1
vote
0answers
26 views

Use an alias with watch command [duplicate]

The post repeat command every x seconds shows that watch is the utility that is useful for the invoking a command at fixed interval repeatedly. Now, I have very long commands, and have used aliases ...
9
votes
2answers
12k views

Reading from a continuously changing logfile [duplicate]

There is /location/of/thefile, which is a continuously changing logfile. The average density of refreshes is 4 per minute, the possible maximal refresh rate could be 30-40 per minute. Every refresh ...
3
votes
1answer
333 views

watch command to delete files in a directory every N secs

I thought of using watch command to delete files in a directory every N seconds with the command running in background. This is what I was planning to use: nohup watch -n1200 rm -rf /var/log/radius/...
1
vote
2answers
2k views

How to watch pgrep?

When running a pgrep command with watch it does not only show the actual pgrep output, but also the watch process as well. Example: watch pgrep -lf donothing will show 3 processes, although ...
0
votes
1answer
67 views

Watch goes blank on refresh [duplicate]

I'm running the following command in watch. Works for the first one but subsequent ones go blank watch diff <(pacman -Q) <(ssh kate "pacman -Q")
3
votes
3answers
1k views

Can I reload variable in a watch command?

Part of my job involves some data handling. One of the tasks is to 'flatten' a set of directories (which we'll call Dir for now), and copy them to a new location called DirFlat. This can take a long ...
2
votes
1answer
4k views

Chaining commands within `watch`

Ok, this is driving me a bit nuts. I'm trying to watch the number of files in a set of subdirectories. find . | wc -l correctly returns the number of sub-folders and files. However, watch 'find . | ...
4
votes
1answer
1k views

watch command not showing colors for 'git status'

I'm trying to get watch to display colors from 'git status'. I've tried running watch with the --color option, as suggested elsewhere here, but, still, watch --color 'git status' doesn't display ...
7
votes
1answer
2k views

'watch'-ing curl yields unexpected output

I'm trying to watch curl for live feedback on HTTP tweaks. However, when I execute the command, the output is garbled with some download stats. I've tried sending curl's stderr to /dev/null, to no ...
2
votes
1answer
667 views

How can I extend the wait time for the watch command beyond 4200 or so seconds?

I have encountered a limitation of the watch command. Even though I specify watch -n 14400 to run the command every 4 hours or so, the command executes every 4200 or so seconds, which is about an ...
3
votes
2answers
899 views

using watch with ssh

I have a script: export TERM=xterm watch -t -d -n 1 'netstat -veeantpo | grep 43597 when we run this script though ssh, it does not determine the monitor resolution. so lines are wrapped although ...