Small Mosaic


Categories:

/books
/career
/codinghorrors
/events
/geekstuff
/justdont
/languages
/languages/bash
/linkshot
/magazines
/meta
/misctech
/movies
/nottech
/operatingsystems
/operatingsystems/linux
/operatingsystems/linux/debian
/operatingsystems/solaris
/perl
/presentations
/programming
/python
/ruby
/security
/security/apache
/security/tools
/serversmells
/services
/services/dns
/sites
/specifications
/sysadmin
/testing
/tools
/tools/commandline
/tools/firefox
/tools/gui
/tools/network
/tools/online
/tools/online/greasemonkey
/tools/puppet
/unixdaemon

Archives:

July 20111
June 20112
May 20113
April 20112
March 20117
January 20111
December 20103
November 20103
August 20101
July 20101
June 20104
May 20102
April 20101
March 20108
February 20101
January 20102
Full Archives

Sun, 11 Jul 2004

Who Watches Watch?
The watch command is one of those little gems that often gets overlooked and has its functionality duplicated by a custom tool; just slower and more complicated. At its most basic watch runs the specified command every two seconds until interrupted, a simple example that shows the current directories content is given below, this will show any changes in either the size or timestamp of the contents.

watch ls -ahl

Watch excels in showing real-time differences, by supplying either '-d' or the long option '--differences' any changes will be marked on screen using inverse colours. Running this command on two separate machines allows you to easily drill down on any changes taking effect, a good example is when comparing two MySQL slaves with a command like this:

watch -d -n 1 mysqladmin ext

In most cases this is ideal however only the changes from the most recent iteration are shown, if you want any changes since the command began to stay highlighted then you need either of the following cumulative flags:

watch -d=cumulative command
watch --differences=cumulative command

Like this post? - Digg Me! | Add to del.icio.us! | reddit this!

Posted: 2004/07/11 11:14 | /tools/commandline | Permanent link to this entry | This entry and same date


books career codinghorrors events geekstuff justdont magazines meta misctech movies nottech operatingsystems/linux operatingsystems/linux/debian operatingsystems/solaris perl programming python ruby security security/apache security/tools serversmells services/dns sites sysadmin testing tools tools/commandline tools/firefox tools/gui tools/network tools/online tools/online/greasemonkey tools/puppet unixdaemon

Copyright © 2000-2010 Dean Wilson XML feed logo