Questions tagged [watch]

watch will execute a program periodically, displaying the output.

watch is part of the procps(/proc filesystem utilities) package.

It can be used to monitor the output of a defined command at a specified interval of time.

Example usage:

watch -n 60 'du -sh /var/spool/mail'
131 questions
63
votes
6 answers

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 contents once the number of entries fills the vertical…
Zaid
  • 10,642
43
votes
6 answers

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 also want to store the count for each second. What I need is the output of the following command as a list which will be updated every second: watch -n1…
41
votes
3 answers

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 than 1 second. To test, I ran this command run on a…
Kyle
  • 513
14
votes
2 answers

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 exit if a file is added or removed. What actually…
terdon
  • 242,166
10
votes
1 answer

Using watch or alternative to watch multiple commands at once

While running data-heavy scripts that take a long time to run, I like to use these commands to monitor the status/progress of the script. I can then leave the constantly-updating output open as sort of a progress bar. watch qstat #see status of job…
naglemi
  • 123
4
votes
1 answer

Getting "Segmentation fault (core dumped)" every time I try to run `watch` with `nvidia-smi`

I'm currently using GPUs on an Ubuntu server to run machine learning models. I often like to use the watch command in order to monitor the GPU statuses like watch -n 1 nvidia-smi. It usually works fine, but I noticed that for one of the servers I…
Sean
  • 181
4
votes
2 answers

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 /var/log/secure using watch command?
2
votes
1 answer

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 hour's worth of wait. Otherwise very useful command,…
Sherry
  • 21
  • 1
  • 3
1
vote
4 answers

Make watch reevaluate command

Hi I have a problem running watch command like this: watch cat /proc/$(ps ax | grep processname | grep -v grep | awk '{print $1}')/status The command works when I start it. However, then I restart the process being watched and the watch command…
nobody
  • 1,710
1
vote
1 answer

what is the right syntax for watch command

I want to follow the word BLOCK in ufw.log file every two seconds I try this command: sudo watch BLOCK /var/log/ufw.log but I getting: sh: 1: BLOCK: not found what is the right command? Thank You Edit Following this command tail -f…
0
votes
1 answer

Get updated output when using watch

I use watch to monitor the progress of file conversions. watch -n 2 "echo Converted: $(ls *.mp3 | wc -l) of $(ls *.wav | wc -l) files" When using command substitutions using the $(command) syntax the values don't get updated each time watch reruns…
Moka
  • 155
  • 1
  • 9
0
votes
2 answers

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 ls\ --color If I remove either --no-title or…
Shamaoke
  • 201
  • 3
  • 7
-1
votes
1 answer

Watch command: Updates only periodically, not event-based? (Example: Every 2 seconds - every time file x gets saved)

What I'd like to have: Running a command y with watch command and have watch command update only as soon as output of command y has changed. Imagine a bash script with 3 lines of echo output Hello world! Hello universe! Aloha multiverse! I want the…