<?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>Squarebits Blog</title>
	<atom:link href="http://www.squarebits.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.squarebits.com</link>
	<description>My mostly tech ramblings</description>
	<lastBuildDate>Tue, 10 Mar 2009 20:18:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting the Linux Password from a Script</title>
		<link>http://www.squarebits.com/?p=31</link>
		<comments>http://www.squarebits.com/?p=31#comments</comments>
		<pubDate>Tue, 10 Mar 2009 20:18:35 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.squarebits.com/?p=31</guid>
		<description><![CDATA[Use a command like this&#8230;
echo $PASSWORD} &#124; passwd &#8211;stdin ${USERNAME}
]]></description>
			<content:encoded><![CDATA[<p>Use a command like this&#8230;</p>
<p><font size="3">echo $PASSWORD} | passwd &#8211;stdin ${USERNAME}</font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.squarebits.com/?feed=rss2&amp;p=31</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSP Comments within Comments</title>
		<link>http://www.squarebits.com/?p=30</link>
		<comments>http://www.squarebits.com/?p=30#comments</comments>
		<pubDate>Mon, 04 Aug 2008 06:48:20 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[JSP]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.squarebits.com/?p=30</guid>
		<description><![CDATA[Have you ever run into that frustrating situation where you have JSP comments in your code, and need to comment out a large block of code that
contains those comments.  The situation looks something like this:
&#60;%@ taglib uri=&#8220;http://java.sun.com/jsp/jstl/core&#8221; prefix=&#8221;c&#8221; %&#62;
&#60;%@ taglib uri=&#8220;http://java.sun.com/jsp/jstl/functions&#8221; prefix=&#8221;fn&#8221; %&#62;
&#60;c:if test=&#8221;${!empty param.userInput}&#8221;&#62;
&#60;%&#8211; Trim the userInput &#8211;%&#62;
&#60;c:set var=&#8221;trimmedUserInput&#8221; value=&#8221;${fn:trim(param.userInput)}&#8221;&#62;
&#60;/c:if&#62;
&#60;html&#62;
&#60;form action=&#8221;.&#8221;&#62;
&#60;p&#62;
-${param.userInput}&#8211;${trimmedUserInput}-
&#60;/p&#62;
&#60;p&#62;
User input: &#60;input [...]]]></description>
			<content:encoded><![CDATA[<pre>Have you ever run into that frustrating situation where you have JSP comments in your code, and need to comment out a large block of code that
contains those comments.  The situation looks something like this:</pre>
<blockquote><p>&lt;%@ taglib uri=<a href="http://java.sun.com/jsp/jstl/core" class="moz-txt-link-rfc2396E">&#8220;http://java.sun.com/jsp/jstl/core&#8221;</a> prefix=&#8221;c&#8221; %&gt;<br />
&lt;%@ taglib uri=<a href="http://java.sun.com/jsp/jstl/functions" class="moz-txt-link-rfc2396E">&#8220;http://java.sun.com/jsp/jstl/functions&#8221;</a> prefix=&#8221;fn&#8221; %&gt;</p>
<p>&lt;c:if test=&#8221;${!empty param.userInput}&#8221;&gt;<br />
&lt;%&#8211; Trim the userInput &#8211;%&gt;<br />
&lt;c:set var=&#8221;trimmedUserInput&#8221; value=&#8221;${fn:trim(param.userInput)}&#8221;&gt;<br />
&lt;/c:if&gt;</p>
<p>&lt;html&gt;<br />
&lt;form action=&#8221;.&#8221;&gt;</p>
<p>&lt;p&gt;<br />
-${param.userInput}&#8211;${trimmedUserInput}-<br />
&lt;/p&gt;</p>
<p>&lt;p&gt;<br />
User input: &lt;input type=&#8221;text&#8221; name=&#8221;userInput&#8221; value=&#8221; Some Input.<br />
&#8220;&gt;<br />
&lt;/p&gt;<br />
&lt;p&gt;<br />
&lt;input type=&#8221;submit&#8221;&gt;<br />
&lt;/p&gt;<br />
&lt;/form&gt;<br />
&lt;/html&gt;</p></blockquote>
<pre>Now say you wanted to comment out the &lt;c:if&gt; block for testing ... the
problem is this won't work:</pre>
<blockquote><p>&lt;%&#8211;<br />
&lt;c:if test=&#8221;${!empty param.userInput}&#8221;&gt;<br />
&lt;%&#8211; Trim the userInput &#8211;%&gt;<br />
&lt;c:set var=&#8221;trimmedUserInput&#8221; value=&#8221;${fn:trim(param.userInput)}&#8221;&gt;<br />
&lt;/c:if&gt;<br />
&#8211;%&gt;</p></blockquote>
<pre>because the inner comments "break" the outer comments (it's just not legal
syntax).  What to do?  A nice way to deal with this is to use the following
syntax for your general comments:</pre>
<blockquote><p>&lt;% // Trim the userInput %&gt;</p></blockquote>
<pre>You can legally wrap that syntax with &lt;%-- --%&gt; style comments!  So the
above code, with the test comments included would look like:</pre>
<blockquote><p>&lt;%@ taglib uri=<a href="http://java.sun.com/jsp/jstl/core" class="moz-txt-link-rfc2396E">&#8220;http://java.sun.com/jsp/jstl/core&#8221;</a> prefix=&#8221;c&#8221; %&gt;<br />
&lt;%@ taglib uri=<a href="http://java.sun.com/jsp/jstl/functions" class="moz-txt-link-rfc2396E">&#8220;http://java.sun.com/jsp/jstl/functions&#8221;</a> prefix=&#8221;fn&#8221; %&gt;</p>
<p>&lt;%&#8211;<br />
&lt;c:if test=&#8221;${!empty param.userInput}&#8221;&gt;<br />
&lt;% // Trim the userInput %&gt;<br />
&lt;c:set var=&#8221;trimmedUserInput&#8221; value=&#8221;${fn:trim(param.userInput)}&#8221;&gt;<br />
&lt;/c:if&gt;<br />
&#8211;%&gt;</p>
<p>&lt;html&gt;<br />
&lt;form action=&#8221;.&#8221;&gt;</p>
<p>&lt;p&gt;<br />
-${param.userInput}&#8211;${trimmedUserInput}-<br />
&lt;/p&gt;</p>
<p>&lt;p&gt;<br />
User input: &lt;input type=&#8221;text&#8221; name=&#8221;userInput&#8221; value=&#8221; Some Input.<br />
&#8220;&gt;<br />
&lt;/p&gt;<br />
&lt;p&gt;<br />
&lt;input type=&#8221;submit&#8221;&gt;<br />
&lt;/p&gt;<br />
&lt;/form&gt;<br />
&lt;/html&gt;</p></blockquote>
<pre>Happy documenting!</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.squarebits.com/?feed=rss2&amp;p=30</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manipulating Lists in JSTL</title>
		<link>http://www.squarebits.com/?p=29</link>
		<comments>http://www.squarebits.com/?p=29#comments</comments>
		<pubDate>Wed, 21 May 2008 17:10:53 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[JSP]]></category>

		<guid isPermaLink="false">http://www.squarebits.com/?p=29</guid>
		<description><![CDATA[A common problem when coding in JSTL is that you would like to have an ArrayList of items that you can iterate over.  For example imagine that you have a list of Animals like:
1) Sylvester
2) Goofy
3) Mickey

&#60;c:forEach items="${animalList}" var="animal"&#62;${animal}&#60;&#60;/c:forEach&#62;
And you would like the output to be in the same order:
Sylvester
Goofy
Mickey
The problem is that you [...]]]></description>
			<content:encoded><![CDATA[<p>A common problem when coding in JSTL is that you would like to have an <code>ArrayList</code> of items that you can iterate over.  For example imagine that you have a list of Animals like:</p>
<p>1) Sylvester</p>
<p>2) Goofy</p>
<p>3) Mickey</p>
<pre>
&lt;c:forEach items="${animalList}" var="animal"&gt;${animal}&lt;&lt;/c:forEach&gt;</pre>
<p>And you would like the output to be in the same order:</p>
<p>Sylvester</p>
<p>Goofy</p>
<p>Mickey</p>
<p>The problem is that you can&#8217;t do this:</p>
<p>&lt;jsp:useBean id=&#8221;animalList&#8221; class=&#8221;java.util.ArrayList&#8221;/&gt;</p>
<p>because &lt;c:set&gt; doesn&#8217;t work with &lt;i&gt;ArrayLists&lt;/i&gt;, and so there is no good way to use JSTL to add those values.</p>
<p>This fails:</p>
<p>&lt;c:set target=&#8221;${animalList}&#8221; value=&#8221;Sylvester&#8221;/&gt;</p>
<p>&lt;c:set target=&#8221;${animalList}&#8221; value=&#8221;Goofy&#8221;/&gt;</p>
<p>&lt;c:set target=&#8221;${animalList}&#8221; value=&#8221;Mickey&#8221;/&gt;</p>
<p>You could do this, and I wouldn&#8217;t argue if you do:</p>
<p>&lt;c:set var=&#8221;dummyVar&#8221; value=&#8221;${animalList.add(&#8217;Sylvester&#8217;)}&#8221;/&gt;</p>
<p>&lt;c:set var=&#8221;dummyVar&#8221; value=&#8221;${animalList.add(&#8217;Goofy&#8217;)}&#8221;/&gt;</p>
<p>&lt;c:set var=&#8221;dummyVar&#8221; value=&#8221;${animalList.add(&#8217;Mickey&#8217;)}&#8221;/&gt;</p>
<p>However, its a little ugly, because you have to use dummyVars.  Still I will admit I have used this technique a lot. Another solution that you might be considering is to use HashMaps, which do work with &lt;c:set&gt;.</p>
<p>&lt;jsp:useBean id=&#8221;animalMap&#8221; class=&#8221;java.util.HashMap&#8221;/&gt;</p>
<p>&lt;c:set target=&#8221;${animalMap}&#8221; property=&#8221;cat&#8221; value=&#8221;Sylvester&#8221;/&gt;</p>
<p>&lt;c:set target=&#8221;${animalMap}&#8221; property=&#8221;dog&#8221; value=&#8221;Goofy&#8221;/&gt;</p>
<p>&lt;c:set target=&#8221;${animalMap}&#8221; property=&#8221;rat&#8221; value=&#8221;Rat&#8221;/&gt;</p>
<p>&lt;c:forEach items=&#8221;${animalMap.values()}&#8221; var=&#8221;animal&#8221;&gt;</p>
<p>${animal}&lt;br&gt;</p>
<p>&lt;/c:forEach&gt;</p>
<p>This is cool because there is not hackish method calls on objects that JSTL doesn&#8217;t understand.  Also the elements can now be referenced indirectly, instead of having to loop on the list to find a particular element. But there is a problem: The order has been lost!  When this loop fires it dumps the animals in the order that they are stored in the HashMap, which for all practical purposes is random.</p>
<p>The solution: &lt;b&gt;java.util.LinkedHashMap&lt;/b&gt;</p>
<p>By replacing java.util.HashMap in the example above with</p>
<p>java.util.LinkedHashMap, you get the best of both worlds! &lt;b&gt;Ordered</p>
<p>elements&lt;/b&gt; and &lt;b&gt;Indirect Reference&lt;/b&gt;:</p>
<p>&lt;jsp:useBean id=&#8221;animalMap&#8221; class=&#8221;java.util.LinkedHashMap&#8221;/&gt;</p>
<p>&lt;c:set target=&#8221;${animalMap}&#8221; property=&#8221;cat&#8221; value=&#8221;Sylvester&#8221;/&gt;</p>
<p>&lt;c:set target=&#8221;${animalMap}&#8221; property=&#8221;dog&#8221; value=&#8221;Goofy&#8221;/&gt;</p>
<p>&lt;c:set target=&#8221;${animalMap}&#8221; property=&#8221;rat&#8221; value=&#8221;Rat&#8221;/&gt;</p>
<p>These are ordered:&lt;br&gt;</p>
<p>&lt;c:forEach items=&#8221;${animalMap.values()}&#8221; var=&#8221;animal&#8221;&gt;</p>
<p>${animal}&lt;br&gt;</p>
<p>&lt;/c:forEach&gt;</p>
<p>And this references a particular element:&lt;br&gt;</p>
<p>${animalMap['dog']}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.squarebits.com/?feed=rss2&amp;p=29</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing an item from a Map using JSP</title>
		<link>http://www.squarebits.com/?p=28</link>
		<comments>http://www.squarebits.com/?p=28#comments</comments>
		<pubDate>Fri, 30 Nov 2007 19:57:51 +0000</pubDate>
		<dc:creator>kent</dc:creator>
				<category><![CDATA[JSP]]></category>

		<guid isPermaLink="false">http://www.squarebits.com/?p=28</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p>A common need for working with Maps in JSP is the ability to remove items from the Map.&nbsp; With JSTL it is not so obvious how to do this, yet it turns out to be very easy by simply using an EL expression to call the remove(key) method on the map.&nbsp; Here is an example&#8230;</p>
<blockquote><p><code>&nbsp;</code></p>
<p>&lt;%@ taglib uri=&quot;http://java.sun.com/jsp/jstl/core&quot; prefix=&quot;c&quot; %&gt; </p>
<p>&lt;html&gt; <br />&lt;body&gt; </p>
<p>&lt;p&gt;Creating hash map and populate it ..&lt;/p&gt; </p>
<p>&lt;jsp:useBean id=&quot;map&quot; class=&quot;java.util.HashMap&quot;/&gt; <br />&lt;c:set target=&quot;${map}&quot; property=&quot;cat&quot; value=&quot;brown&quot;/&gt; <br />&lt;c:set target=&quot;${map}&quot; property=&quot;dog&quot; value=&quot;green&quot;/&gt; <br />&lt;c:set target=&quot;${map}&quot; property=&quot;rat&quot; value=&quot;black&quot;/&gt; </p>
<p>&lt;p&gt;Remove dog and store its former value in a local variable &#8230;&lt;/p&gt; </p>
<p>&lt;c:set var=&quot;oldDogValue&quot; value=&quot;${map.remove(&#8217;dog&#8217;)}&quot;/&gt; </p>
<p>&lt;/body&gt; <br />&lt;/html&gt; </p>
</blockquote>
<p>Another great tip from Aaron Freeman at SendThisFile.com.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.squarebits.com/?feed=rss2&amp;p=28</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Handling multiple value parameters in JSP</title>
		<link>http://www.squarebits.com/?p=27</link>
		<comments>http://www.squarebits.com/?p=27#comments</comments>
		<pubDate>Fri, 09 Nov 2007 16:00:23 +0000</pubDate>
		<dc:creator>kent</dc:creator>
				<category><![CDATA[JSP]]></category>

		<guid isPermaLink="false">http://www.squarebits.com/?p=27</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p>In JSP, you cannot simply use an expression like ${param.weekday} to retreive multiple values if the request has multiple values assigned like the form below&#8230;</p>
<p>&lt;input name=&quot;weekday&quot; value=&quot;Sunday&quot; checked&gt;<br />&lt;input name=&quot;weekday&quot; value=&quot;Monday&quot; checked&gt;</p>
<p>Instead, use an expression like ${fn:join(paramValues['weekday'], &#8216;,&#8217;)} to retreive a comma delimited list of values for the parameter.</p>
<p>Tip provided by Aaron Freeman from SendThisFile.com.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.squarebits.com/?feed=rss2&amp;p=27</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Delete All Subdirectories with a Specific Name</title>
		<link>http://www.squarebits.com/?p=26</link>
		<comments>http://www.squarebits.com/?p=26#comments</comments>
		<pubDate>Wed, 24 Oct 2007 16:39:09 +0000</pubDate>
		<dc:creator>kent</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.squarebits.com/?p=26</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you want to delete all the &quot;CVS&quot; subdirectories anywhere below a top level &quot;/opt/project&quot; directory.&nbsp; Here is how you can do this&#8230;</p>
<ol>
<li>Execute <strong><code>cd /opt/project</code></strong> to change to the top level directory below which you wish to delete the &quot;CVS&quot; subdirectories</li>
<p></p>
<li>Execute <strong><code>find -type d -name 'CVS' -ls</code></strong> to see a preview of all the directories that will be deleted.</li>
<p></p>
<li>If the preview seems ok, you can then execute <strong><code>find -type d -name 'CVS' -exec rm -fr {} \;</code></strong> to actually delete all the subdirectories (you&#8217;ll get a No such file or directory error when executing but the subdirectories are still deleted).</li>
</ol>
<p>Obviously, this can work with any subdirectory name as you would just replace CVS above with your subdirectory name.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.squarebits.com/?feed=rss2&amp;p=26</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Determine the Parameter Names of a Java Method at Run-time</title>
		<link>http://www.squarebits.com/?p=25</link>
		<comments>http://www.squarebits.com/?p=25#comments</comments>
		<pubDate>Fri, 24 Aug 2007 03:27:52 +0000</pubDate>
		<dc:creator>kent</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.squarebits.com/?p=25</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p>The Java reflection API does not allow you to determine parameter names of a method at run-time; however, you can accomplish this by using a library within the Apache Axis2 project to read parameter names of a Java method at run-time.&nbsp; Here is an example&#8230;</p>
<blockquote><p><code>import java.lang.reflect.*;<br />import org.apache.axis2.description.java2wsdl.bytecode.*;</p>
<p>public class Test {</p>
<p>&nbsp; public static void main(String[] args) {</p>
<p>&nbsp; &nbsp; try {<br />&nbsp; &nbsp;&nbsp; &nbsp;// Nothing new here, just find the method we want to <br />&nbsp; &nbsp;&nbsp; &nbsp;// lookup the parameter names<br />&nbsp; &nbsp;&nbsp; &nbsp;Method m = Test.class.getMethod(<br />&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &quot;addNumbers&quot;, <br />&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; new Class[] {Long.class, Long.class}<br />&nbsp; &nbsp;&nbsp; &nbsp;);</p>
<p>&nbsp; &nbsp;&nbsp; &nbsp;// This uses the Apache Axis2 ChainedParamReader class to <br />&nbsp; &nbsp;&nbsp; &nbsp;// determine the parameter names<br />&nbsp; &nbsp;&nbsp; &nbsp;ChainedParamReader pr = new ChainedParamReader(Test.class);<br />&nbsp; &nbsp;&nbsp; &nbsp;String[] paramNames = pr.getParameterNames(m);</p>
<p>&nbsp; &nbsp;&nbsp; &nbsp;// Print the resulting paramNames<br />&nbsp; &nbsp;&nbsp; &nbsp;for (String paramName : paramNames) {<br />&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; System.out.println(paramName);<br />&nbsp; &nbsp;&nbsp; &nbsp;}<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; catch (Exception e) {<br />&nbsp; &nbsp;&nbsp; &nbsp;System.err.println(e);<br />&nbsp; &nbsp; }<br />&nbsp; }</p>
<p>&nbsp; public Long addNumbers(Long firstValue, Long secondValue) {<br />&nbsp; &nbsp; return firstValue + secondValue;<br />&nbsp; }<br />}</code></p>
</blockquote>
<p>You can compile and execute this which result in&#8230;</p>
<blockquote><pre>C:\temp&gt;javac -cp axis2-kernel-1.3.jar -g Test.java

C:\temp&gt;java -cp .;axis2-kernel-1.3.jar Test

firstValuesecondValue</pre>
</blockquote>
<p><strong>Important:</strong> You must compile your classes with the debug switch (-g) for this to work.&nbsp; The ChainedParamReader class uses the debug information in the binary class file to determine the parameter names.</p>
<p>You can get the axis2-kernel-1.3.jar from <a href="http://ws.apache.org/axis2/">http://ws.apache.org/axis2/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.squarebits.com/?feed=rss2&amp;p=25</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>On the fly compression of mysqldump output</title>
		<link>http://www.squarebits.com/?p=24</link>
		<comments>http://www.squarebits.com/?p=24#comments</comments>
		<pubDate>Fri, 30 Mar 2007 21:26:41 +0000</pubDate>
		<dc:creator>kent</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.squarebits.com/?p=24</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p>Found this tip <a href="http://www.ducea.com/2006/10/28/compressing-mysqldump-output/">here</a> &#8212; you can compress your mysqldump output by executing&#8230;</p>
<blockquote><p><code>mysqldump my_database_name | gzip &gt; my_database_name.sql.gz</code></p>
</blockquote>
<p>You can even process these compressed files directly by executing&#8230;</p>
<blockquote><p><code>gunzip &lt; my_database_name.sql.gz | mysql -D my_database_name</code></p>
</blockquote>
<p>Very useful to process backups/restores with limited disk space on a server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.squarebits.com/?feed=rss2&amp;p=24</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Work Around &#8220;Argument List Too Long&#8221; Error Deleting a Gazillion Files Under Linux</title>
		<link>http://www.squarebits.com/?p=23</link>
		<comments>http://www.squarebits.com/?p=23#comments</comments>
		<pubDate>Thu, 28 Dec 2006 15:29:10 +0000</pubDate>
		<dc:creator>kent</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.squarebits.com/?p=23</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p>You can receive the error <code>argument list too long</code> trying to execute a <code>rm -f *</code> in a directory with a lot of files but there is a very simple workaround.&nbsp; Simply execute this instead to delete the files&#8230;</p>
<blockquote><p><code>find . -name &quot;*&quot; -type f -maxdepth 1 -exec rm {} \;</code></p>
</blockquote>
<p><strong>Important:</strong> Executing a <code>find . -exec rm {} \;</code> is equivalent to executing a <code>rm -f *</code> &#8212; be sure you know what you are doing and be sure you are in the right directory when you execute this.</p>
<p>Note that the <code>-name &quot;*&quot;</code> switch avoids deleting system files and the <code>-maxdepth 1</code> switch avoids deleting files in subdirectories.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.squarebits.com/?feed=rss2&amp;p=23</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How To Identify the Files/Directories Chewing Up Disk Space Under Linux</title>
		<link>http://www.squarebits.com/?p=22</link>
		<comments>http://www.squarebits.com/?p=22#comments</comments>
		<pubDate>Mon, 04 Dec 2006 18:44:15 +0000</pubDate>
		<dc:creator>kent</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.squarebits.com/?p=22</guid>
		<description><![CDATA[If you are running out of disk space under Linux, here are three useful commands to help identify which files and directories are chewing up the most disk space&#8230;

Show the 50 largest files&#8230;find / -path '/proc' -prune -o -size +1000k -printf '%s   %p\n' &#124; sort -k1 -g -r &#124; head -50
Show the 50 [...]]]></description>
			<content:encoded><![CDATA[<p>If you are running out of disk space under Linux, here are three useful commands to help identify which files and directories are chewing up the most disk space&#8230;</p>
<ol>
<li>Show the 50 largest files&#8230;<code>find / -path '/proc' -prune -o -size +1000k -printf '%s   %p\n' | sort -k1 -g -r | head -50</code></li>
<li>Show the 50 largest directories (excluding files in subdirectories)&#8230;<code>du -kS / | sort -k1 -g -r | fgrep -v '/proc' | head -50</code></li>
<li>Show the 50 largest directories (including files in subdirectories)&#8230;<code>du -k / | sort -k1 -g -r | fgrep -v '/proc' | head -50</code></li>
</ol>
<p><strong>Important:</strong> As these commands may take a little while to run, you should not run these commands on a production system where a significant increase in load would have an adverse impact.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.squarebits.com/?feed=rss2&amp;p=22</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
