<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>beer planet &#187; watch</title> <atom:link href="http://beerpla.net/tag/watch/feed/" rel="self" type="application/rss+xml" /><link>http://beerpla.net</link> <description>where things have nothing to do with beer - tutorials, tips, how-tos, thoughts, hacks, and other techy nonsense</description> <lastBuildDate>Thu, 17 May 2012 22:50:53 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <atom:link rel='hub' href='http://beerpla.net/?pushpress=hub'/> <item><title>Watch &#8211; A Useful Linux Command You May Have Never Heard Of</title><link>http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/</link> <comments>http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/#comments</comments> <pubDate>Sun, 05 Aug 2007 03:18:01 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[bsd]]></category> <category><![CDATA[cmdwatch]]></category> <category><![CDATA[unix]]></category> <category><![CDATA[watch]]></category> <guid
isPermaLink="false">http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/</guid> <description><![CDATA[<p>How many times did I want to watch a directory waiting for a file to appear in it? Constant ls, for example, quickly got boring. A quick Perl script that would reload ls every 5 seconds&#8230; yeah it works but it takes a while to type up, and often enough I&#039;m too lazy for that. And then I found &#039;watch&#039; &#8211; a utility that comes with most *nix distros. Look at this beauty [man watch]:</p><p>NAME<br
/> <strong> watch &#8211; execute a program periodically, showing output fullscreen</strong></p><p>SYNOPSIS<br
/> watch  [-dhvt]  [-n  ]  [--differences[=cumulative]]  [--help]<br
/> [--interval=] [--no-title] [--version]</p><p>DESCRIPTION<br
/> <strong>watch runs command repeatedly, displaying its output (the first screen<br
/> full). </strong> This  allows you to watch the program output change over time.<br
/> By default, ...<div
class=clear></div> <a
href="http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<p>How many times did I want to watch a directory waiting for a file to appear in it? Constant ls, for example, quickly got boring. A quick Perl script that would reload ls every 5 seconds&#8230; yeah it works but it takes a while to type up, and often enough I&#039;m too lazy for that. And then I found &#039;watch&#039; &#8211; a utility that comes with most *nix distros. Look at this beauty [man watch]:</p><p>NAME<br
/> <strong> watch &#8211; execute a program periodically, showing output fullscreen</strong></p><p>SYNOPSIS<br
/> watch  [-dhvt]  [-n  ]  [--differences[=cumulative]]  [--help]<br
/> [--interval=] [--no-title] [--version]</p><p>DESCRIPTION<br
/> <strong>watch runs command repeatedly, displaying its output (the first screen<br
/> full). </strong> This  allows you to watch the program output change over time.<br
/> By default, the program is run every 2 seconds; use -n or &#8211;interval to<br
/> specify a different interval.</p><p><strong>The  -d  or  &#8211;differences  flag will highlight the differences between<br
/> successive  updates</strong>.   The  &#8211;cumulative  option   makes   highlighting<br
/> &#034;sticky&#034;,  presenting a running display of all positions that have ever<br
/> changed.  The -t or &#8211;no-title option turns off the header showing  the<br
/> interval,  command, and current time at the top of the display, as well<br
/> as the following blank line.</p><p>watch will run until interrupted.</p><p>NOTE<br
/> Note that command is given to &#034;sh -c&#034; which means that you may need  to<br
/> use extra quoting to get the desired effect.</p><p>Note  that  POSIX  option  processing  is used (i.e., option processing<br
/> stops at the first non-option argument).  This means that  flags  after<br
/> command don&#039;t get interpreted by watch itself.</p><p>EXAMPLES<br
/> To watch for mail, you might do</p><div
class="wp_syntax"><div
class="code"><pre>watch -n 60 from</pre></div></div><p>To watch the contents of a directory change, you could use</p><div
class="wp_syntax"><div
class="code"><pre>watch -d ls -l</pre></div></div><p>If you&#039;re only interested in files owned by user joe, you might use</p><div
class="wp_syntax"><div
class="code"><pre>watch -d 'ls -l | fgrep joe'</pre></div></div><p>To see the effects of quoting, try these out</p><div
class="wp_syntax"><div
class="code"><pre>watch echo $$
watch echo '$$'
watch echo &quot;'&quot;'$$'&quot;'&quot;</pre></div></div><p>You can watch for your administrator to install the latest kernel with</p><div
class="wp_syntax"><div
class="code"><pre>watch uname -r</pre></div></div><p>(Just kidding.)</p><p>Now if anyone knows how to make watch print the bottom part of the command output rather than the top, please post a comment.</p><p>Edit: BSD users, &#034;watch&#034; out. watch does something completely different on BSD (it lets you snoop on other users&#039; ttys). The corresponding BSD command is actually <a
href="http://www.freshports.org/sysutils/cmdwatch/">cmdwatch</a>.</p><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Watch+-+A+Useful+Linux+Command+You+May+Have+Never+Heard+Of&amp;link=http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/&amp;notes=How%20many%20times%20did%20I%20want%20to%20watch%20a%20directory%20waiting%20for%20a%20file%20to%20appear%20in%20it%3F%20Constant%20ls%2C%20for%20example%2C%20quickly%20got%20boring.%20A%20quick%20Perl%20script%20that%20would%20reload%20ls%20every%205%20seconds...%20yeah%20it%20works%20but%20it%20takes%20a%20while%20to%20type%20up%2C%20and%20often%20enough%20I%27m%20too%20lazy%20for%20that.%20And%20then%20I%20found%20%27watch%27&amp;short_link=http://bit.ly/br3jya&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Watch+-+A+Useful+Linux+Command+You+May+Have+Never+Heard+Of&amp;link=http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/&amp;notes=How%20many%20times%20did%20I%20want%20to%20watch%20a%20directory%20waiting%20for%20a%20file%20to%20appear%20in%20it%3F%20Constant%20ls%2C%20for%20example%2C%20quickly%20got%20boring.%20A%20quick%20Perl%20script%20that%20would%20reload%20ls%20every%205%20seconds...%20yeah%20it%20works%20but%20it%20takes%20a%20while%20to%20type%20up%2C%20and%20often%20enough%20I%27m%20too%20lazy%20for%20that.%20And%20then%20I%20found%20%27watch%27&amp;short_link=http://bit.ly/br3jya&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=Watch+-+A+Useful+Linux+Command+You+May+Have+Never+Heard+Of&amp;link=http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/&amp;notes=How%20many%20times%20did%20I%20want%20to%20watch%20a%20directory%20waiting%20for%20a%20file%20to%20appear%20in%20it%3F%20Constant%20ls%2C%20for%20example%2C%20quickly%20got%20boring.%20A%20quick%20Perl%20script%20that%20would%20reload%20ls%20every%205%20seconds...%20yeah%20it%20works%20but%20it%20takes%20a%20while%20to%20type%20up%2C%20and%20often%20enough%20I%27m%20too%20lazy%20for%20that.%20And%20then%20I%20found%20%27watch%27&amp;short_link=http://bit.ly/br3jya&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=Watch+-+A+Useful+Linux+Command+You+May+Have+Never+Heard+Of&amp;link=http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/&amp;notes=How%20many%20times%20did%20I%20want%20to%20watch%20a%20directory%20waiting%20for%20a%20file%20to%20appear%20in%20it%3F%20Constant%20ls%2C%20for%20example%2C%20quickly%20got%20boring.%20A%20quick%20Perl%20script%20that%20would%20reload%20ls%20every%205%20seconds...%20yeah%20it%20works%20but%20it%20takes%20a%20while%20to%20type%20up%2C%20and%20often%20enough%20I%27m%20too%20lazy%20for%20that.%20And%20then%20I%20found%20%27watch%27&amp;short_link=http://bit.ly/br3jya&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=Watch+-+A+Useful+Linux+Command+You+May+Have+Never+Heard+Of&amp;link=http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/&amp;notes=How%20many%20times%20did%20I%20want%20to%20watch%20a%20directory%20waiting%20for%20a%20file%20to%20appear%20in%20it%3F%20Constant%20ls%2C%20for%20example%2C%20quickly%20got%20boring.%20A%20quick%20Perl%20script%20that%20would%20reload%20ls%20every%205%20seconds...%20yeah%20it%20works%20but%20it%20takes%20a%20while%20to%20type%20up%2C%20and%20often%20enough%20I%27m%20too%20lazy%20for%20that.%20And%20then%20I%20found%20%27watch%27&amp;short_link=http://bit.ly/br3jya&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=Watch+-+A+Useful+Linux+Command+You+May+Have+Never+Heard+Of&amp;link=http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/&amp;notes=How%20many%20times%20did%20I%20want%20to%20watch%20a%20directory%20waiting%20for%20a%20file%20to%20appear%20in%20it%3F%20Constant%20ls%2C%20for%20example%2C%20quickly%20got%20boring.%20A%20quick%20Perl%20script%20that%20would%20reload%20ls%20every%205%20seconds...%20yeah%20it%20works%20but%20it%20takes%20a%20while%20to%20type%20up%2C%20and%20often%20enough%20I%27m%20too%20lazy%20for%20that.%20And%20then%20I%20found%20%27watch%27&amp;short_link=http://bit.ly/br3jya&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=Watch+-+A+Useful+Linux+Command+You+May+Have+Never+Heard+Of&amp;link=http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/&amp;notes=How%20many%20times%20did%20I%20want%20to%20watch%20a%20directory%20waiting%20for%20a%20file%20to%20appear%20in%20it%3F%20Constant%20ls%2C%20for%20example%2C%20quickly%20got%20boring.%20A%20quick%20Perl%20script%20that%20would%20reload%20ls%20every%205%20seconds...%20yeah%20it%20works%20but%20it%20takes%20a%20while%20to%20type%20up%2C%20and%20often%20enough%20I%27m%20too%20lazy%20for%20that.%20And%20then%20I%20found%20%27watch%27&amp;short_link=http://bit.ly/br3jya&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Watch%20-%20A%20Useful%20Linux%20Command%20You%20May%20Have%20Never%20Heard%20Of&amp;link=http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/&amp;notes=How%20many%20times%20did%20I%20want%20to%20watch%20a%20directory%20waiting%20for%20a%20file%20to%20appear%20in%20it%3F%20Constant%20ls%2C%20for%20example%2C%20quickly%20got%20boring.%20A%20quick%20Perl%20script%20that%20would%20reload%20ls%20every%205%20seconds...%20yeah%20it%20works%20but%20it%20takes%20a%20while%20to%20type%20up%2C%20and%20often%20enough%20I%27m%20too%20lazy%20for%20that.%20And%20then%20I%20found%20%27watch%27&amp;short_link=http://bit.ly/br3jya&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2010/03/06/how-to-show-hiddeninvisible-files-in-total-commander-both-locally-and-on-an-ftp-server/" rel="bookmark" title="March 6, 2010">How To Show Hidden/Invisible Files In Total Commander, Both Locally And On An FTP Server</a></li><li><a
href="http://beerpla.net/2010/06/10/how-to-display-just-the-http-response-code-in-cli-curl/" rel="bookmark" title="June 10, 2010">How To Display Just The HTTP Response Code In Command Line Curl</a></li><li><a
href="http://beerpla.net/2006/07/15/converting-from-cvs-to-svn-developers-notes-and-why-svn-is-better/" rel="bookmark" title="July 15, 2006">Converting from CVS to SVN: Developer&#039;s Notes And Why SVN Is Better</a></li><li><a
href="http://beerpla.net/2009/10/29/modern-day-frame-busting-with-x-frame-options-and-this-content-cannot-be-displayed-in-a-frame-warnings/" rel="bookmark" title="October 29, 2009">Modern-Day Frame Busting With X-FRAME-OPTIONS And &quot;This content cannot be displayed in a frame&quot; Warnings</a></li><li><a
href="http://beerpla.net/2008/10/11/how-to-sort-folders-the-same-way-as-files-in-total-commander/" rel="bookmark" title="October 11, 2008">How To Sort Folders The Same Way As Files In Total Commander</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2007%2F08%2F04%2Fwatch-a-useful-linux-command-you-may-have-never-heard-of%2F&amp;title=Watch%20%26%238211%3B%20A%20Useful%20Linux%20Command%20You%20May%20Have%20Never%20Heard%20Of" id="wpa2a_2"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2007/08/04/watch-a-useful-linux-command-you-may-have-never-heard-of/feed/</wfw:commentRss> <slash:comments>16</slash:comments> </item> </channel> </rss>
