watch will execute a program periodically, displaying the output.

learn more… | top users | synonyms

1
vote
2answers
152 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
177 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 ...
4
votes
1answer
155 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 ...
2
votes
2answers
73 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 ...
2
votes
0answers
132 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 ...
10
votes
3answers
432 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
176 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
258 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 ...
2
votes
2answers
1k 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
1
vote
2answers
64 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 ...
1
vote
1answer
444 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 ...
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 ...
12
votes
2answers
312 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 ...
3
votes
1answer
197 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 ...
0
votes
1answer
59 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")
2
votes
3answers
547 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 ...
1
vote
2answers
1k 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 ...
5
votes
4answers
5k 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 ...
2
votes
1answer
3k 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 . | ...
5
votes
1answer
1k 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 ...
3
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 ...
19
votes
4answers
5k 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 ...
2
votes
1answer
426 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 ...
2
votes
2answers
540 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 ...
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. ...
6
votes
5answers
4k 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?
7
votes
2answers
7k 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 ...
45
votes
7answers
39k 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 ...
22
votes
2answers
3k 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 ...