<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: 3 Unix Shell Scripts &#8211; User Activity, View Processes, Display Memory</title>
	<atom:link href="http://www.thegeekstuff.com/2010/07/3-shell-scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thegeekstuff.com/2010/07/3-shell-scripts/</link>
	<description>Guides, HowTos and Tips for Technology Geeks</description>
	<lastBuildDate>Thu, 09 Feb 2012 11:52:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Bubnoff</title>
		<link>http://www.thegeekstuff.com/2010/07/3-shell-scripts/comment-page-1/#comment-57206</link>
		<dc:creator>Bubnoff</dc:creator>
		<pubDate>Mon, 02 Aug 2010 22:01:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=5260#comment-57206</guid>
		<description>Thanks for the yet another great article!

I believe that you could get rid of an extra pipe in mem.sh by using awk&#039;s built-in grep
functionality [ tested on Debian Lenny ]:
free -t -m &#124; awk &#039;/Swap/{ print &quot;Total Swap space : &quot;$2 &quot; MB&quot;;
print &quot;Used Swap Space : &quot;$3&quot; MB&quot;;
print &quot;Free Swap : &quot;$4&quot; MB&quot;;

Also, since sed takes files as arguments, one could get rid of the cats in ...eg.,: 
cat /tmp/a &#124; sed &#039;1,2d&#039;&#124;  awk &#039;{print $1}&#039; &#124; uniq

Like so:
sed &#039;1,2d&#039; /tmp/a &#124;  awk &#039;{print $1}&#039; &#124; uniq

Thanks again!

Bubnoff</description>
		<content:encoded><![CDATA[<p>Thanks for the yet another great article!</p>
<p>I believe that you could get rid of an extra pipe in mem.sh by using awk&#8217;s built-in grep<br />
functionality [ tested on Debian Lenny ]:<br />
free -t -m | awk &#8216;/Swap/{ print &#8220;Total Swap space : &#8220;$2 &#8221; MB&#8221;;<br />
print &#8220;Used Swap Space : &#8220;$3&#8243; MB&#8221;;<br />
print &#8220;Free Swap : &#8220;$4&#8243; MB&#8221;;</p>
<p>Also, since sed takes files as arguments, one could get rid of the cats in &#8230;eg.,:<br />
cat /tmp/a | sed &#8217;1,2d&#8217;|  awk &#8216;{print $1}&#8217; | uniq</p>
<p>Like so:<br />
sed &#8217;1,2d&#8217; /tmp/a |  awk &#8216;{print $1}&#8217; | uniq</p>
<p>Thanks again!</p>
<p>Bubnoff</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Felix Frank</title>
		<link>http://www.thegeekstuff.com/2010/07/3-shell-scripts/comment-page-1/#comment-57090</link>
		<dc:creator>Felix Frank</dc:creator>
		<pubDate>Mon, 02 Aug 2010 08:26:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=5260#comment-57090</guid>
		<description>Be aware that the CPU usage percentage as reported by ps is not what you may think it is. It says nothing about what the process is doing currently. Instead, it reports the ratio of time the process has spent in the &quot;running&quot; state vs. its &quot;sleeping&quot; time. So, if one of the users is running, say, a mysqld that has been doing stuff for a couple of hours, but has gone dormant some minutes ago, it will still report a high percentage of CPU usage, even though it is perfectly idle by now. If you care about current CPU usage, I&#039;d recommend top instead of ps.

Also, avoid gratuitous use of cat as the beginning of pipelines where it is utterly unneeded. It&#039;s considered bad style.

And while we&#039;re at it, it&#039;s a good habit to always use sort before uniq, because if the uniq input ends up being unsorted for any reason, uniq itself becomes rather pointless.</description>
		<content:encoded><![CDATA[<p>Be aware that the CPU usage percentage as reported by ps is not what you may think it is. It says nothing about what the process is doing currently. Instead, it reports the ratio of time the process has spent in the &#8220;running&#8221; state vs. its &#8220;sleeping&#8221; time. So, if one of the users is running, say, a mysqld that has been doing stuff for a couple of hours, but has gone dormant some minutes ago, it will still report a high percentage of CPU usage, even though it is perfectly idle by now. If you care about current CPU usage, I&#8217;d recommend top instead of ps.</p>
<p>Also, avoid gratuitous use of cat as the beginning of pipelines where it is utterly unneeded. It&#8217;s considered bad style.</p>
<p>And while we&#8217;re at it, it&#8217;s a good habit to always use sort before uniq, because if the uniq input ends up being unsorted for any reason, uniq itself becomes rather pointless.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: beparas</title>
		<link>http://www.thegeekstuff.com/2010/07/3-shell-scripts/comment-page-1/#comment-56774</link>
		<dc:creator>beparas</dc:creator>
		<pubDate>Sat, 31 Jul 2010 07:09:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=5260#comment-56774</guid>
		<description>Thank you very much.
These are very useful scripts.</description>
		<content:encoded><![CDATA[<p>Thank you very much.<br />
These are very useful scripts.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Content Delivery Network via Amazon Web Services: CloudFront: static.thegeekstuff.com

Served from: www.thegeekstuff.com @ 2012-02-09 10:47:23 -->
