<?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>I Can Has Linux? &#187; watch</title>
	<atom:link href="http://icanhaslinux.com/category/watch/feed/" rel="self" type="application/rss+xml" />
	<link>http://icanhaslinux.com</link>
	<description>Invisible Patent Infringement!</description>
	<lastBuildDate>Tue, 08 Jun 2010 23:47:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>watch what `watch` can do</title>
		<link>http://icanhaslinux.com/2008/01/08/watch-what-watch-can-do/</link>
		<comments>http://icanhaslinux.com/2008/01/08/watch-what-watch-can-do/#comments</comments>
		<pubDate>Tue, 08 Jan 2008 21:24:21 +0000</pubDate>
		<dc:creator>LightningCrash</dc:creator>
				<category><![CDATA[watch]]></category>

		<guid isPermaLink="false">http://icanhaslinux.com/2008/01/08/watch-what-watch-can-do/</guid>
		<description><![CDATA[I've been running a lot of scripts recently that require me to check on things that I can't monitor with `tail -f logname`. Mainly to keep an eye on a process and get information about the processes running that I'm interested in. Periodically, one hangs and I like to just jump back to it and kill it.

Watch to the rescue!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been running a lot of scripts recently that require me to check on things that I can&#8217;t monitor with `<code>tail -f logname</code>`. Mainly to keep an eye on a process and get information about the processes running that I&#8217;m interested in. Periodically, one hangs and I like to just jump back to it and kill it.</p>
<p>Watch to the rescue!</p>
<p>Watch executes a command at a specified period. For instance, if I&#8217;m extracting a file and want to monitor the progress, I can simply type:<br />
<code><br />
watch 'ls -la filename.ext'</code></p>
<p>and I will get the output from `<code>ls -la filename.ext</code>` every 2 seconds.</p>
<p>If my internet connection is down and I am impatiently waiting for it to come back up, I can run:</p>
<p><code>watch -n15 'ping -c1 www.google.com'<br />
</code><br />
If I&#8217;m forking processes in a Bash script and want to make sure none of them are hung:</p>
<p><code>watch -n2 'ps ax|grep [p]rocessname'</code></p>
<p>It&#8217;s very handy!</p>
<p>I periodically come across an issue whereby `<code>tail -f /var/log/syslog</code>` will hang after operating for a couple of hours. I solve this by using the following instead:</p>
<p><code>watch -n5 'tail  -n20 /var/log/syslog'</code></p>
<p>`man watch` to find more uses for this program. I tried `woman watch` but apparently Linux doesn&#8217;t carry those.</p>
<p>and holy sweet crap, it&#8217;s been a long time since I wrote an article on this site!</p>
<p>Until next time,</p>
<p>-LightningCrash</p>
]]></content:encoded>
			<wfw:commentRss>http://icanhaslinux.com/2008/01/08/watch-what-watch-can-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
