<?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: 10 bad UNIX or Linux command line usage patterns to avoid</title> <atom:link href="http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Kevin</title><link>http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-143981</link> <dc:creator>Kevin</dc:creator> <pubDate>Fri, 06 Jun 2008 00:04:32 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-143981</guid> <description>-exec starts a separate shell for each command.
xargs does  it in one process.</description> <content:encoded><![CDATA[<p>-exec starts a separate shell for each command.<br
/> xargs does  it in one process.</p> ]]></content:encoded> </item> <item><title>By: Christopher Cashell</title><link>http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-143747</link> <dc:creator>Christopher Cashell</dc:creator> <pubDate>Sun, 11 May 2008 06:22:52 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-143747</guid> <description>I know this was posted a long time ago, but in case someone else comes across it, a note in response to:
&lt;em&gt;However, there is no need to use ‘xargs’ with ‘find’ since ‘find’ has the -exec flag which does the same thing and doesn’t require a pipe.&lt;/em&gt;
That&#039;s not actually true.  In many simple cases, you can use -exec.  However, depending on the number of items returned by find, and the action you&#039;re taking, it can be a *lot* less efficient using -exec in comparison to xargs.
For example, say you are building a list of files to delete with find, and it is going to return 100k files.  If you use &lt;code&gt;find fpo/ -exec rm -rf &#039;{}&#039; \;&lt;/code&gt;, then you will be exec()&#039;ing rm 100k times.  If you use &lt;code&gt;find foo/ -print &#124; xargs rm -rf&lt;/code&gt;, then xargs will build the command argument list for rm to an appropriate length.  For the sake of argument, say it runs rm with 1000 entries each time.  That means you&#039;re now only exec()&#039;ing rm 100 times, instead of 100k times.  When you&#039;re dealing with large numbers like this, the time and CPU cycles to exec() your command that many times can have a very real performance impact.</description> <content:encoded><![CDATA[<p>I know this was posted a long time ago, but in case someone else comes across it, a note in response to:</p><p><em>However, there is no need to use ‘xargs’ with ‘find’ since ‘find’ has the -exec flag which does the same thing and doesn’t require a pipe.</em></p><p>That&#8217;s not actually true.  In many simple cases, you can use -exec.  However, depending on the number of items returned by find, and the action you&#8217;re taking, it can be a *lot* less efficient using -exec in comparison to xargs.</p><p>For example, say you are building a list of files to delete with find, and it is going to return 100k files.  If you use <code>find fpo/ -exec rm -rf '{}' \;</code>, then you will be exec()&#8217;ing rm 100k times.  If you use <code>find foo/ -print | xargs rm -rf</code>, then xargs will build the command argument list for rm to an appropriate length.  For the sake of argument, say it runs rm with 1000 entries each time.  That means you&#8217;re now only exec()&#8217;ing rm 100 times, instead of 100k times.  When you&#8217;re dealing with large numbers like this, the time and CPU cycles to exec() your command that many times can have a very real performance impact.</p> ]]></content:encoded> </item> <item><title>By: pip</title><link>http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-72574</link> <dc:creator>pip</dc:creator> <pubDate>Mon, 12 Feb 2007 16:21:30 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-72574</guid> <description>sorry forgot to tick the notify box... this should solve it... cheers</description> <content:encoded><![CDATA[<p>sorry forgot to tick the notify box&#8230; this should solve it&#8230; cheers</p> ]]></content:encoded> </item> <item><title>By: pip</title><link>http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-72571</link> <dc:creator>pip</dc:creator> <pubDate>Mon, 12 Feb 2007 16:19:32 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-72571</guid> <description>Hey why stop piping cat&#039;s? What&#039;s bad in doing so? redirect the stdinput?</description> <content:encoded><![CDATA[<p>Hey why stop piping cat&#8217;s? What&#8217;s bad in doing so? redirect the stdinput?</p> ]]></content:encoded> </item> <item><title>By: nixcraft</title><link>http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-43137</link> <dc:creator>nixcraft</dc:creator> <pubDate>Mon, 18 Dec 2006 23:10:02 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-43137</guid> <description>LOL @ Paul
Thanks for sharing with us.</description> <content:encoded><![CDATA[<p>LOL @ Paul</p><p>Thanks for sharing with us.</p> ]]></content:encoded> </item> <item><title>By: Paul McNamara</title><link>http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-43057</link> <dc:creator>Paul McNamara</dc:creator> <pubDate>Mon, 18 Dec 2006 18:23:47 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-43057</guid> <description>Not being fluent in UNIX myself (not speaking a word, actually), I had a little fun with Stutz&#039;s list, in particular, No. 10: &quot;stop piping cats.&quot;
http://www.networkworld.com/community/?q=node/9764</description> <content:encoded><![CDATA[<p>Not being fluent in UNIX myself (not speaking a word, actually), I had a little fun with Stutz&#8217;s list, in particular, No. 10: &#8220;stop piping cats.&#8221;<br
/> <a
href="http://www.networkworld.com/community/?q=node/9764" rel="nofollow">http://www.networkworld.com/community/?q=node/9764</a></p> ]]></content:encoded> </item> <item><title>By: Jonathan</title><link>http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-40840</link> <dc:creator>Jonathan</dc:creator> <pubDate>Thu, 14 Dec 2006 03:21:13 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-40840</guid> <description>Yeah, but it will be a cold day in hell before I remember the bizarre -exec syntax without trying it a dozen times or more! &quot;Now where does {} go? And what about that semi-colon? Or is it a colon?&quot; :-)</description> <content:encoded><![CDATA[<p>Yeah, but it will be a cold day in hell before I remember the bizarre -exec syntax without trying it a dozen times or more! &#8220;Now where does {} go? And what about that semi-colon? Or is it a colon?&#8221; :-)</p> ]]></content:encoded> </item> <item><title>By: Daemon Dancing in the Dark</title><link>http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-40839</link> <dc:creator>Daemon Dancing in the Dark</dc:creator> <pubDate>Thu, 14 Dec 2006 03:19:41 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-40839</guid> <description>&lt;strong&gt;Be Nice To Your Commandline...&lt;/strong&gt;
Good article showing you 10 things to avoid when using the command line. To wit: Make directory trees in a single swipe. Change the path; do not move the archive. Combine your commands with control operators. Quote variables with caution. Use escape se...</description> <content:encoded><![CDATA[<p><strong>Be Nice To Your Commandline&#8230;</strong></p><p>Good article showing you 10 things to avoid when using the command line. To wit: Make directory trees in a single swipe. Change the path; do not move the archive. Combine your commands with control operators. Quote variables with caution. Use escape se&#8230;</p> ]]></content:encoded> </item> <item><title>By: nixcraft</title><link>http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-40623</link> <dc:creator>nixcraft</dc:creator> <pubDate>Wed, 13 Dec 2006 18:46:03 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-40623</guid> <description>Doug,
I must agree with. It always good idea to use KISS philosophy.
Appreciate your post.</description> <content:encoded><![CDATA[<p>Doug,</p><p>I must agree with. It always good idea to use KISS philosophy.</p><p>Appreciate your post.</p> ]]></content:encoded> </item> <item><title>By: Doug Keester</title><link>http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-40618</link> <dc:creator>Doug Keester</dc:creator> <pubDate>Wed, 13 Dec 2006 18:01:53 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/learn-10-good-unix-linux-usage-habits.html#comment-40618</guid> <description>Overall a decent article.
However, there is no need to use &#039;xargs&#039; with &#039;find&#039; since &#039;find&#039; has the -exec flag which does the same thing and doesn&#039;t require a pipe.</description> <content:encoded><![CDATA[<p>Overall a decent article.</p><p>However, there is no need to use &#8216;xargs&#8217; with &#8216;find&#8217; since &#8216;find&#8217; has the -exec flag which does the same thing and doesn&#8217;t require a pipe.</p> ]]></content:encoded> </item> </channel> </rss>
