<?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>The Linux Juggernaut</title>
	<atom:link href="http://www.linuxnix.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxnix.com</link>
	<description>roles on......</description>
	<lastBuildDate>Wed, 16 May 2012 02:26:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Redhat Flagship distro RHEL7 to release in 2013 second half</title>
		<link>http://www.linuxnix.com/2012/05/redhat-flagship-distro-rhel7-release-2013.html</link>
		<comments>http://www.linuxnix.com/2012/05/redhat-flagship-distro-rhel7-release-2013.html#comments</comments>
		<pubDate>Wed, 16 May 2012 02:17:41 +0000</pubDate>
		<dc:creator>Surendra Anne</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.linuxnix.com/?p=1519</guid>
		<description><![CDATA[<p>Redhat announced that they are going to release RHEL7 by second half of 2013 on the occasion of their 10th anniversary of RHEL1 release some 10 years back. Jim Totten, vice president and general manager at Red Hat&#8217;s Platform business unit announced this in a webcast. There will be 2000 packages upgraded in this release and more improvements to support many hardware, security, Filesystems and performance.</p>
<p>Redhat releases their flagship distro for every 3 years &#8230; <a href="http://www.linuxnix.com/2012/05/redhat-flagship-distro-rhel7-release-2013.html" class="read_more">Continue Reading</a></p>]]></description>
			<content:encoded><![CDATA[<p>Redhat announced that they are going to release RHEL7 by second half of 2013 on the occasion of their 10th anniversary of RHEL1 release some 10 years back. Jim Totten, vice president and general manager at Red Hat&#8217;s Platform business unit announced this in a webcast. There will be 2000 packages upgraded in this release and more improvements to support many hardware, security, Filesystems and performance.</p>
<p>Redhat releases their flagship distro for every 3 years and patches for every 6 months. Here is a quick release dates of all the Versions of RHEL taken from Wikipedia.org</p>
<ul>
<li><strong>Red Hat Enterprise Linux 2.1 AS (<em>Pensacola</em>), 2002-03-26</strong>
<ul>
<li>Update 1, 2003-02-14 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/2.1/html/AS_Release_Notes/RELEASE-NOTES-U1" rel="nofollow">Release Notes</a>)</li>
<li>Update 2, 2003-05-02 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/2.1/html/AS_Release_Notes/RELEASE-NOTES-U2" rel="nofollow">Release Notes</a>)</li>
<li>Update 3, 2003-12-19 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/2.1/html/AS_Release_Notes/RELEASE-NOTES-U3" rel="nofollow">Release Notes</a>)</li>
<li>Update 4, 2004-04-30 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/2.1/html/AS_Release_Notes/RELEASE-NOTES-U4" rel="nofollow">Release Notes</a>)</li>
<li>Update 5, 2004-08-18 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/2.1/html/AS_Release_Notes/RELEASE-NOTES-U5" rel="nofollow">Release Notes</a>)</li>
<li>Update 6, 2004-12-13 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/2.1/html/AS_Release_Notes/RELEASE-NOTES-U6" rel="nofollow">Release Notes</a>)</li>
<li>Update 7, 2005-04-28 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/2.1/html/AS_Release_Notes/RELEASE-NOTES-U7" rel="nofollow">Release Notes</a>, <a href="https://rhn.redhat.com/errata/RHBA-2005-362.html" rel="nofollow">redhat-release-as-2.1AS-121.src.rpm</a>)</li>
</ul>
</li>
<li><strong>Red Hat Enterprise Linux 2.1 ES (<em>Panama</em>), May 2003</strong></li>
</ul>
<ul>
<li><strong>Red Hat Enterprise Linux 3 (<em>Taroon</em>), 2003-10-22. Uses <a title="Linux (kernel)" href="http://en.wikipedia.org/wiki/Linux_(kernel)">Linux</a> 2.4.21 (<a href="http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/" rel="nofollow">Release notes also for updates</a>)</strong>
<ul>
<li>Update 1, 2004-01-16 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/3/html/Release_Notes/as-x86/RELEASE-NOTES-U1-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>Update 2, 2004-05-18 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/3/html/Release_Notes/as-x86/RELEASE-NOTES-U2-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>Update 3, 2004-09-03 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/3/html/Release_Notes/as-x86/RELEASE-NOTES-U3-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>Update 4, 2004-12-21 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/3/html/Release_Notes/as-x86/RELEASE-NOTES-U4-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>Update 5, 2005-05-20 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/3/html/Release_Notes/as-x86/RELEASE-NOTES-U5-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>Update 6, 2005-09-28 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/3/html/Release_Notes/as-x86/RELEASE-NOTES-U6-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>Update 7, 2006-03-15 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/3/html/Release_Notes/as-x86/RELEASE-NOTES-U7-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>Update 8, 2006-07-20 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/3/html/Release_Notes/as-x86/RELEASE-NOTES-U8-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>Update 9, 2007-06-15 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/3/html/Release_Notes/RELEASE-NOTES-U9-i386-en.html" rel="nofollow">Release Notes</a>)</li>
</ul>
</li>
<li><strong>Red Hat Enterprise Linux 4 (<em>Nahant</em>), 2005-02-15. Uses Linux kernel 2.6.9-5</strong>
<ul>
<li>4.1, also termed Update 1, 2005-06-09 (kernel 2.6.9-11, <a href="http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/release-notes/as-x86/RELEASE-NOTES-U1-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>4.2, also termed Update 2, 2005-10-05 (kernel 2.6.9-22, <a href="http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/release-notes/as-x86/RELEASE-NOTES-U2-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>4.3, also termed Update 3, 2006-03-07 (kernel 2.6.9-34, <a href="http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/release-notes/as-x86/RELEASE-NOTES-U3-x86-en.html" rel="nofollow">Release Notes</a>) (<a href="http://www.centos.org/docs/4/html/release-notes/as-x86/RELEASE-NOTES-U3-en.html" rel="nofollow">Release Notes on centos.org</a>)</li>
<li>4.4, also termed Update 4, 2006-08-11 (kernel 2.6.9-42, <a href="http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/release-notes/as-x86/RELEASE-NOTES-U4-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>4.5, also termed Update 5, 2007-05-01 (kernel 2.6.9-55, <a href="http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/release-notes/RELEASE-NOTES-U5-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>4.6, also termed Update 6, 2007-11-15 (kernel 2.6.9-67, <a href="http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/release-notes/RELEASE-NOTES-U6-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>4.7, also termed Update 7, 2008-07-24 (kernel 2.6.9-78, <a href="http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/release-notes/RELEASE-NOTES-U7-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>4.8, also termed Update 8, 2009-05-18 (kernel 2.6.9-89, <a href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/4.8/html/Release_Notes/index.html" rel="nofollow">Release Notes</a>)</li>
<li>4.9, also termed Update 9, 2011-02-16 (kernel 2.6.9-100, <a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/4/html/4.9_Release_Notes/index.html" rel="nofollow">Release Notes</a>)</li>
</ul>
</li>
<li><strong>Red Hat Enterprise Linux 5 (<em>Tikanga</em>), 2007-03-14. Uses <a title="Linux (kernel)" href="http://en.wikipedia.org/wiki/Linux_(kernel)">Linux</a> kernel 2.6.18-8 (<a href="http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/release-notes/RELEASE-NOTES-x86-en.html" rel="nofollow">Release notes</a>)</strong>
<ul>
<li>5.1, also termed Update 1, 2007-11-07 (kernel 2.6.18-53, <a href="http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/release-notes/RELEASE-NOTES-U1-x86-en.html" rel="nofollow">Release Notes</a>)</li>
<li>5.2, also termed Update 2, 2008-05-21 (kernel 2.6.18-92, <a href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Release_Notes/x86/index.html" rel="nofollow">Release Notes</a>, <a href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Release_Notes/singles/relnotesU2-x86.html" rel="nofollow">single file</a>)</li>
<li>5.3, also termed Update 3, 2009-01-20 (kernel 2.6.18-128, <a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/5.3_Release_Notes" rel="nofollow">Release Notes</a>)</li>
<li>5.4, also termed Update 4, 2009-09-02 (kernel 2.6.18-164, <a href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.4/html/Release_Notes/" rel="nofollow">Release Notes</a>)</li>
<li>5.5, also termed Update 5, 2010-03-30 (kernel 2.6.18-194, <a href="http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.5/html/Release_Notes/" rel="nofollow">Release Notes</a>)</li>
<li>5.6, also termed Update 6, 2011-01-12 (kernel 2.6.18-238, <a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/5.6_Release_Notes/" rel="nofollow">Release Notes</a> and <a href="https://rhn.redhat.com/errata/RHEA-2011-0020.html" rel="nofollow">Errata for release</a>)</li>
<li>5.7, also termed Update 7, 2011-07-21 (kernel 2.6.18-274, <a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/5.7_Release_Notes/index.html" rel="nofollow">Release Notes</a> and <a href="https://rhn.redhat.com/errata/RHEA-2011-0977.html" rel="nofollow">Errata for release</a>)</li>
<li>5.8, also termed Update 8, 2012-02-21 (kernel 2.6.18-308, <a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/5.8_Release_Notes/index.html" rel="nofollow">Release Notes</a> and <a href="https://rhn.redhat.com/errata/RHEA-2012-0315.html" rel="nofollow">Errata for release</a>)</li>
</ul>
</li>
<li><strong>Red Hat Enterprise Linux 6 (<em>Santiago</em>), 2010-11-10 Uses <a title="Linux (kernel)" href="http://en.wikipedia.org/wiki/Linux_(kernel)">Linux</a> kernel 2.6.32-71 (<a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/6.0_Release_Notes/" rel="nofollow">Release Notes</a>).</strong>
<ul>
<li>6.1 also termed Update 1, 2011-05-19 (kernel 2.6.32-131, <a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/6.1_Release_Notes/" rel="nofollow">Release Notes</a> and <a href="http://www.redhat.com/about/news/prarchive/2011/Red-Hat-Delivers-Red-Hat-Enterprise-Linux-6-1" rel="nofollow">Release Announcement</a>)</li>
<li>6.2 also termed Update 2, 2011-12-06 (kernel 2.6.32-220, <a href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/6.2_Release_Notes/" rel="nofollow">Release Notes</a> and <a href="https://rhn.redhat.com/errata/RHEA-2011-1543.html" rel="nofollow">Errata for release</a>)</li>
</ul>
</li>
</ul>
<p>Please free to share your knowledge on this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxnix.com/2012/05/redhat-flagship-distro-rhel7-release-2013.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>12 examples to use flower brackets in Linux</title>
		<link>http://www.linuxnix.com/2012/05/12-examples-flower-brackets-linux.html</link>
		<comments>http://www.linuxnix.com/2012/05/12-examples-flower-brackets-linux.html#comments</comments>
		<pubDate>Tue, 15 May 2012 04:01:13 +0000</pubDate>
		<dc:creator>Surendra Anne</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[seq]]></category>

		<guid isPermaLink="false">http://www.linuxnix.com/?p=1502</guid>
		<description><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;">Flower brackets examples</span></h1>
<p>This is a small post on how to crate multiple files/folders, sequence generation with flower brackets in-order to save valuable time.</p>
<p>Creating empty files can be done with touch command. We will see how to create multiple files using this command in one shot</p>
<p><strong>Example1:</strong> Create a file with name abc.txt</p>
<pre><strong>touch abc.txt</strong></pre>
<p><strong>Example2: </strong>Create multiple files abc, cde, efg, hij, klm</p>
<pre><strong>touch  abc cde efg hij klm</strong></pre>
<p><strong>Example3: </strong>How about creating 1 &#8230; <a href="http://www.linuxnix.com/2012/05/12-examples-flower-brackets-linux.html" class="read_more">Continue Reading</a></p>]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;">Flower brackets examples</span></h1>
<p>This is a small post on how to crate multiple files/folders, sequence generation with flower brackets in-order to save valuable time.</p>
<p>Creating empty files can be done with touch command. We will see how to create multiple files using this command in one shot</p>
<p><strong>Example1:</strong> Create a file with name abc.txt</p>
<pre><strong>touch abc.txt</strong></pre>
<p><strong>Example2: </strong>Create multiple files abc, cde, efg, hij, klm</p>
<pre><strong>touch  abc cde efg hij klm</strong></pre>
<p><strong>Example3: </strong>How about creating 1 to 20 files, ie creating multiple files with one command. Its bit tedious job for an admin. Don&#8217;t worry Linux provide us with some useful option with &#8220;Flower braces&#8221; to do expansion. Instead of writing below command</p>
<pre><strong>touch 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20</strong></pre>
<p>We can create 20 files using flower brace {} exapantion as shown below..</p>
<pre><strong>touch {1..20}</strong></pre>
<p>Your shell tries to expand this brace and generate 1 to 20 numbers. The above command will create total 20 files in one shot.</p>
<p><strong>Example4:</strong> How about creating files as 1.txt, 2.txt, 3.txt up to 1000.txt. This can be achieved suffixing it after brackets as shown below.</p>
<pre><strong>touch {1..1000}.txt</strong></pre>
<p><strong>Example5:</strong> how about creating a1, a2, a3 so on up to a1000 files?</p>
<pre><strong>touch a{1..1000}</strong></pre>
<p><strong>Example6:</strong>How about generating numbers?. We can generate numbers using flower braces with echo command. The other way to generate numbers is seq command.</p>
<pre><strong>echo {1..10}</strong></pre>
<p><strong>Example7:</strong> Even we can do sequence for alphabets as shown below</p>
<pre><strong>touch {a..z}</strong></pre>
<p><strong>Example8:</strong> Generate files from A to Z</p>
<pre><strong>touch {A..Z}</strong></pre>
<p><strong>Note:</strong> The above alphabets generation is done using asci values</p>
<p><strong>Example9: </strong>How about creating 1 to 1000000 files in one shot, by using multiplication/matrix of numbers?. We can achieve this one with multiplying two sequences.</p>
<pre><strong>touch {0..1000}{0..1000}</strong></pre>
<p><strong>Example10:</strong> How about creating files as multiples of 2.</p>
<pre><strong>touch {1..100..2}</strong></pre>
<p>this will create files as 1, 3, 5, 7, 9, 11 etc.</p>
<p>Note: This interval will work only bash version 4.0 and above, make a note about this.</p>
<p><strong>Example11:</strong> How about creating files as multiples of 7?</p>
<pre><strong>touch {1..100..7}</strong></pre>
<p><strong>Note:</strong> This interval option will work only bash version 4 and above.</p>
<p><strong>Practical usage of this brackets</strong></p>
<p><strong>1)In bash for loop.</strong></p>
<p><strong>2)Generating sequence of numbers.</strong></p>
<p>As mention in above examples we can create folders similarly in one shot. use -p option if you want to create folders in sub folders too.</p>
<p><strong>Example12:</strong> Create a folder structure as 2012, under this i want to create 12 folders for each month and under each month create 30 folders which corresponding to 30 days.</p>
<pre><strong>mkdir -p 2012/{1..12}/{1..30}</strong></pre>
<div>This will create folder 2012 under that 1 to 12 folders and under each of these folders 1 to 30 folders in one go. Please feel free to comment your thoughts on this.</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxnix.com/2012/05/12-examples-flower-brackets-linux.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>7 Linux read command examples for Shell scripting</title>
		<link>http://www.linuxnix.com/2012/05/7-linux-read-command-examples-shell-scripting.html</link>
		<comments>http://www.linuxnix.com/2012/05/7-linux-read-command-examples-shell-scripting.html#comments</comments>
		<pubDate>Sun, 13 May 2012 03:52:46 +0000</pubDate>
		<dc:creator>Surendra Anne</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[read command]]></category>

		<guid isPermaLink="false">http://www.linuxnix.com/?p=1498</guid>
		<description><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;">read command examples</span></h1>
<p><span style="font-size: small;">read command is useful in scripts when reading an input from user. This read command is used when the script want to interact with user for his inputs.</span></p>
<pre><strong>read command syntax</strong>
 <strong>read VARIABLE</strong></pre>
<p><span style="font-size: small;"><strong>Example1:</strong>Read a value from user input.</span></p>
<pre><strong>read VAR1</strong></pre>
<p><span style="font-size: small;">To display this value we have to use echo command.</span></p>
<pre><strong>echo $VAR1</strong></pre>
<p><span style="font-size: small;"><strong>Example2:</strong> Reading two words/variable/values at a time.</span></p>
<pre><strong>read VAR1 VAR2</strong></pre>
<p><strong></strong><span style="font-size: small;"><strong>Example3: </strong>Reading multiple values at a time.</span></p>
<pre><strong>read </strong>&#8230; <a href="http://www.linuxnix.com/2012/05/7-linux-read-command-examples-shell-scripting.html" class="read_more">Continue Reading</a></pre>]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;">read command examples</span></h1>
<p><span style="font-size: small;">read command is useful in scripts when reading an input from user. This read command is used when the script want to interact with user for his inputs.</span></p>
<pre><strong>read command syntax</strong>
 <strong>read VARIABLE</strong></pre>
<p><span style="font-size: small;"><strong>Example1:</strong>Read a value from user input.</span></p>
<pre><strong>read VAR1</strong></pre>
<p><span style="font-size: small;">To display this value we have to use echo command.</span></p>
<pre><strong>echo $VAR1</strong></pre>
<p><span style="font-size: small;"><strong>Example2:</strong> Reading two words/variable/values at a time.</span></p>
<pre><strong>read VAR1 VAR2</strong></pre>
<p><strong></strong><span style="font-size: small;"><strong>Example3: </strong>Reading multiple values at a time.</span></p>
<pre><strong>read VAR1 VAR2 VAR3 VAR4</strong></pre>
<p><span style="font-size: small;"><strong>Example4:</strong> Read values in to an Array</span></p>
<pre><strong>read VAR1</strong></pre>
<pre><strong></strong><strong>ARR1=(VAR1)</strong></pre>
<p><strong></strong><span style="font-size: small;">to display first value in array use below command</span></p>
<pre><strong>echo ${ARR1[0]}</strong></pre>
<p><strong></strong><span style="font-size: small;"><strong>Example5:</strong> Read values from a command</span></p>
<pre><strong>read VAR1 VAR2 VAR3 &lt;&lt; ( echo surendra kumar anne )</strong></pre>
<pre> <strong>echo "Enter values are $VAR1 $VAR2 $VAR3"</strong></pre>
<p><strong></strong><strong>Example6: </strong>Read user input and give some info to user what he have to give. For this use -p option to display some info when reading value.</p>
<pre><strong>read -p "Please enter 1 to 10 numbers: " VAL1</strong></pre>
<p><strong>Note:</strong> You no need to echo command to display information to user, you can achieve that one using read -p option.</p>
<p><strong style="font-size: small;">Example7: </strong><span style="font-size: small;">Read have inbuilt variable called REPLY. this is system variable which stores read value in to </span><strong style="font-size: small;">$REPLY.</strong></p>
<pre><strong>read -p "Please enter a value"</strong></pre>
<pre><span style="font-size: small;"><strong>echo "Enter value is $REPLY"</strong></span>
 Please share your thoughts on this.</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxnix.com/2012/05/7-linux-read-command-examples-shell-scripting.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>7 linux sort command examples to sort files</title>
		<link>http://www.linuxnix.com/2012/05/7-linux-sort-command-examples-sort-files.html</link>
		<comments>http://www.linuxnix.com/2012/05/7-linux-sort-command-examples-sort-files.html#comments</comments>
		<pubDate>Fri, 11 May 2012 03:38:41 +0000</pubDate>
		<dc:creator>Surendra Anne</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sort]]></category>

		<guid isPermaLink="false">http://www.linuxnix.com/?p=1496</guid>
		<description><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;">Linux/Unix sort command examples</span></h1>
<p><span style="font-size: small;">This is a small tutorial on how to use sort command to soft a file. Sorting is very much useful when dealing with DB files, CSV, xls, log files in fact a text file to. By default sort command will sort according to alpha-bates. First sort tries to sort according to single character, if it finds the first character same in two lines, then it move on to sort second character. </span>&#8230; <a href="http://www.linuxnix.com/2012/05/7-linux-sort-command-examples-sort-files.html" class="read_more">Continue Reading</a></p>]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;">Linux/Unix sort command examples</span></h1>
<p><span style="font-size: small;">This is a small tutorial on how to use sort command to soft a file. Sorting is very much useful when dealing with DB files, CSV, xls, log files in fact a text file to. By default sort command will sort according to alpha-bates. First sort tries to sort according to single character, if it finds the first character same in two lines, then it move on to sort second character. Suppose I have a following word list in a file</span></p>
<p><strong>cat filename.txt</strong></p>
<p><span style="font-size: small;"><strong>abc<br />
cde<br />
hij<br />
klm<br />
kle<br />
ble</strong><br />
</span></p>
<p><span style="font-size: small;">This will be sorted first with first char. When it finds both the char same in this example klm and kle start with same characters, so it tries to sort with third character which is different in them. The output of sort  as below</span></p>
<pre><strong>sort filename.txt</strong></pre>
<p><strong style="font-size: small;">abc</strong></p>
<p><span style="font-size: small;"><strong>ble<br />
cde<br />
hij<br />
kle<br />
klm</strong></span></p>
<p><strong>Sort command syntax</strong></p>
<pre><strong>sort filename.txt</strong></pre>
<p><strong style="font-size: small;">Example1:</strong><span style="font-size: small;"> Sort a given file according to alpha-bates</span></p>
<pre> <strong>sort filename.txt</strong></pre>
<p><strong style="font-size: small;">Example2:</strong><span style="font-size: small;"> I have a file with host names in third column, how can i sort them according to this column?. Use -k for sorting according to column</span></p>
<pre><strong>sort -k3 filename.txt</strong></pre>
<p>The above command will sort according to third column.</p>
<p><strong style="font-size: small;">Example3:</strong><span style="font-size: small;">I want to sort /etc/passwd file according to home directories but my sort is not working how can i sort them?. by default sort will take <strong>space/tabs as field separators</strong>. But in /etc/passwd file the field separator is : so we have to mention this one when sorting a file. This can be done with -t option</span></p>
<pre><strong>sort -t: -k6 /etc/passwd</strong></pre>
<p><strong style="font-size: small;">Example4: </strong><span style="font-size: small;">I want to sort according to number, suppose i want to sort /etc/passwd file according to UID, use -n option to do that.</span></p>
<pre><strong>sort -n -t: -k3 /etc/passwd</strong></pre>
<p><strong style="font-size: small;">Note: </strong>For example w<span style="font-size: small;">ith out -n option sort will put 10 before 3 when it find this values, by default it will sort only first numerical char.</span></p>
<p><strong style="font-size: small;">Example5: </strong><span style="font-size: small;">Sort the file and reverse the order</span></p>
<pre><strong>sort -r filename.txt</strong></pre>
<p><strong style="font-size: small;">Example6:</strong><span style="font-size: small;"> Some times its required to sort the file and display only uniq values.</span></p>
<pre><strong>sort -u filename</strong></pre>
<p><strong>Note: </strong>though the values on other field are different this will not consider by -u option.</p>
<p><strong style="font-size: small;">Example7:</strong><span style="font-size: small;"> I want to sort a file according to my requirement and save it to a different file. Use -o option to save the sorted output to a file.</span></p>
<pre><strong>sort -o temp.txt filename.txt</strong></pre>
<p>You can now mix above options to get your sorting work done.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxnix.com/2012/05/7-linux-sort-command-examples-sort-files.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to find command location in Linux?</title>
		<link>http://www.linuxnix.com/2012/05/linux-find-command-location.html</link>
		<comments>http://www.linuxnix.com/2012/05/linux-find-command-location.html#comments</comments>
		<pubDate>Wed, 09 May 2012 17:28:42 +0000</pubDate>
		<dc:creator>Surendra Anne</dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[linux help]]></category>
		<category><![CDATA[whereis]]></category>
		<category><![CDATA[which]]></category>

		<guid isPermaLink="false">http://www.linuxnix.com/?p=1448</guid>
		<description><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;">How to find command location in Linux and Unix</span></h1>
<p>This is a small how to on finding your command location. Some times its required to find command location to use it as path is not set properly to /bin or /sbin or some other folder. And some times we install packages through scripts where the commands will be installed in a defined path other than /usr/bin or /usr/sbin etc.</p>
<p>command to check where the particular &#8230; <a href="http://www.linuxnix.com/2012/05/linux-find-command-location.html" class="read_more">Continue Reading</a></p>]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;">How to find command location in Linux and Unix</span></h1>
<p>This is a small how to on finding your command location. Some times its required to find command location to use it as path is not set properly to /bin or /sbin or some other folder. And some times we install packages through scripts where the commands will be installed in a defined path other than /usr/bin or /usr/sbin etc.</p>
<p>command to check where the particular command is installed?</p>
<pre><strong>which command-name</strong></pre>
<p><strong>Example:</strong></p>
<pre><strong>which ls</strong></pre>
<p><strong>Output:</strong></p>
<p><strong>root@surendra:/home/surendra# which ls</strong><br />
<strong>/bin/ls</strong><br />
<strong>root@surendra:/home/surendra#</strong></p>
<p>How about getting with other command along with manual pages?</p>
<pre><strong>whereis command-name</strong></pre>
<p><strong>Example:</strong></p>
<pre><strong>whereis ls</strong></pre>
<p><strong> Output:</strong></p>
<p><strong>root@surendra:/home/surendra# whereis ls</strong><br />
<strong>ls: /bin/ls /usr/share/man/man1/ls.1.gz</strong><br />
<strong>root@surendra:/home/surendra#</strong></p>
<p>some times we don&#8217;t know where the command is located but still we want to use it, at these times you can use which command to give entire path</p>
<pre><strong>`which ls`</strong></pre>
<p><strong>or</strong></p>
<pre><strong>$(which ls)</strong></pre>
<p>the above two are very much handy when writing shell scripts when you are not aware/sure where the command located. Please share your thoughts on how you avoid this situation.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxnix.com/2012/05/linux-find-command-location.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to setup two IP address on single NIC in Linux</title>
		<link>http://www.linuxnix.com/2012/05/setup-ip-address-single-nic-linux.html</link>
		<comments>http://www.linuxnix.com/2012/05/setup-ip-address-single-nic-linux.html#comments</comments>
		<pubDate>Sat, 05 May 2012 03:55:41 +0000</pubDate>
		<dc:creator>Surendra Anne</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.linuxnix.com/?p=1405</guid>
		<description><![CDATA[<p>Setting up two IP address on one NIC</p>
<p>This is a small how-to to set up two are more IP address on single LAN card. There are some times which require two IP address to set up so that we can make a Linux box as a router. This can be possible without even having two NIC cards. We can configure two different IP address on single Network Card as shown below.</p>
<p>Setting up 2 &#8230; <a href="http://www.linuxnix.com/2012/05/setup-ip-address-single-nic-linux.html" class="read_more">Continue Reading</a></p>]]></description>
			<content:encoded><![CDATA[<p>Setting up two IP address on one NIC</p>
<p>This is a small how-to to set up two are more IP address on single LAN card. There are some times which require two IP address to set up so that we can make a Linux box as a router. This can be possible without even having two NIC cards. We can configure two different IP address on single Network Card as shown below.</p>
<p>Setting up 2 IP address on &#8220;One&#8221; NIC. This example is on ethernet.</p>
<p>STEP 1:Setting up first IP address. Edit /etc/sysconfig/network-scripts/ifcfg-eth0 on Redhat Linux box and give the following entries as shown.</p>
<p>vi /etc/sysconfig/network-scripts/ifcfg-eth0</p>
<p>DEVICE=eth0<br />
BOOTPROTO=static<br />
IPADDR=192.168.1.10<br />
NETMASK=255.255.255.0<br />
NETWORK=192.168.1.0<br />
ONBOOT=yes</p>
<p>STEP 2: Setting up second IP address. Create one file as /etc/sysconfig/network-scripts/ifcfg-eth0:1 and give the entries as below in to this file.</p>
<p>vi /etc/sysconfig/network-scripts/ifcfg-eth0:1</p>
<p>DEVICE=eth0:1<br />
BOOTPROTO=static<br />
IPADDR=192.168.1.11<br />
NETMASK=255.255.255.0<br />
NETWORK=192.168.1.0<br />
ONBOOT=yes</p>
<p>STEP 3: Once you configure above files and save them. Now reload the network service on your machine.</p>
<p>service network reload</p>
<p>STEP 4: Check if you get the IP address assigned to the eth0 and eth0:1 interfaces respectively.</p>
<p>ifconfig</p>
<p>Note1: We can assign virtual IP to the same interface with ifconfig but that one is not permanent so not giving info on that.</p>
<p>Note2: We can assign up to 16 virtual IP address to a single NIC card.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxnix.com/2012/05/setup-ip-address-single-nic-linux.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert Binary,HEX, Oct to decimal in Linux/Unix</title>
		<link>http://www.linuxnix.com/2012/05/convert-binaryhex-oct-decimal-linuxunix.html</link>
		<comments>http://www.linuxnix.com/2012/05/convert-binaryhex-oct-decimal-linuxunix.html#comments</comments>
		<pubDate>Thu, 03 May 2012 06:52:49 +0000</pubDate>
		<dc:creator>Surendra Anne</dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[shell scripting]]></category>

		<guid isPermaLink="false">http://www.linuxnix.com/?p=1391</guid>
		<description><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;"><strong>Convert Binary,HEX, Oct to decimal</strong></span></h1>
<p>This is a small Shell tutorial on how to convert different bases to other bases.<br />
Some times when working as system admin you require to convert different number systems to others. In this post we will see how to convert different number systems to others.</p>
<h2><span style="color: #ff0000;">Decimal to Binary</span></h2>
<pre><strong>echo "obase=2; 23" &#124; bc</strong></pre>
<p><strong>Output:</strong><br />
<strong>10111</strong><br />
Let me explain above command. <strong>obase</strong> is a<strong> special variable</strong> in bc command which defines &#8230; <a href="http://www.linuxnix.com/2012/05/convert-binaryhex-oct-decimal-linuxunix.html" class="read_more">Continue Reading</a></p>]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;"><strong>Convert Binary,HEX, Oct to decimal</strong></span></h1>
<p>This is a small Shell tutorial on how to convert different bases to other bases.<br />
Some times when working as system admin you require to convert different number systems to others. In this post we will see how to convert different number systems to others.</p>
<h2><span style="color: #ff0000;">Decimal to Binary</span></h2>
<pre><strong>echo "obase=2; 23" | bc</strong></pre>
<p><strong>Output:</strong><br />
<strong>10111</strong><br />
Let me explain above command. <strong>obase</strong> is a<strong> special variable</strong> in bc command which defines the output base value for a given number. There is one more special variable for bc command called<strong> ibase</strong> which defines input base value. In our example we did not mention ibase so by default it will take my input value as decimal value. So we feed <strong>obase=2</strong> and <strong>decimal number 23</strong> to bc command to convert decimal 23 in to <a class="zem_slink" title="Binary numeral system" href="http://en.wikipedia.org/wiki/Binary_numeral_system" rel="wikipedia" target="_blank">binary number</a>.</p>
<h2><span style="color: #ff0000;">Decimal to <a class="zem_slink" title="Octal" href="http://en.wikipedia.org/wiki/Octal" rel="wikipedia" target="_blank">Octal number</a></span></h2>
<pre><strong>echo "obase=8; 23" | bc</strong></pre>
<h2><strong></strong><br />
<span style="color: #ff0000;">Decimal to Hex number</span></h2>
<pre><strong>echo "obase=16; 23" | bc</strong></pre>
<h2><strong></strong><br />
<span style="color: #ff0000;">Decimal to any base number</span></h2>
<p>convert decimal number to <a class="zem_slink" title="Quaternary numeral system" href="http://en.wikipedia.org/wiki/Quaternary_numeral_system" rel="wikipedia" target="_blank">base 4</a> number system</p>
<pre><strong>echo "obase=4; 23" | bc</strong></pre>
<p><strong></strong><br />
How about convert to base 7?</p>
<pre><strong>echo "obase=7; 23" | bc</strong></pre>
<h2><span style="color: #ff0000;">Binary to decimal</span></h2>
<pre><strong>echo "ibase=2; 11010101" | bc</strong></pre>
<h2><span style="color: #ff0000;">Oct to decimal</span></h2>
<pre><strong>echo "ibase=8; 723" | bc</strong></pre>
<h2><span style="color: #ff0000;">Hex to decimal</span></h2>
<pre><strong>echo "ibase=16; 23" | bc</strong></pre>
<h2><span style="color: #ff0000;">How about converting binary to Oct?</span></h2>
<pre><strong>echo "ibase=2;obase=8 1010101" | bc</strong></pre>
<p>As given above we can convert any number system to any number systems</p>
<h2><span style="color: #ff0000;">Other ways to do base convertions</span></h2>
<p>bc will convert from any base to any other base. There are some other tools which can do partially these conventions.<br />
$(()) &#8211;can convert hex to decimal<br />
example:</p>
<pre><strong>echo $((0x123))</strong></pre>
<p><strong>printf command can convert hex and oct to decimal</strong></p>
<p><strong>decimal to Octal</strong></p>
<pre><strong></strong>
<strong>printf "%o\n" 123</strong></pre>
<p><strong></strong><br />
<strong>decimal to Hex</strong></p>
<pre><strong></strong>
<strong>printf "%x\n" 123</strong></pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxnix.com/2012/05/convert-binaryhex-oct-decimal-linuxunix.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to View or see only directories in Linux</title>
		<link>http://www.linuxnix.com/2012/05/view-directories-linux.html</link>
		<comments>http://www.linuxnix.com/2012/05/view-directories-linux.html#comments</comments>
		<pubDate>Tue, 01 May 2012 03:27:12 +0000</pubDate>
		<dc:creator>Surendra Anne</dc:creator>
				<category><![CDATA[Basics]]></category>

		<guid isPermaLink="false">http://www.linuxnix.com/?p=1398</guid>
		<description><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;">How to view/list only directories in Linux?</span></h1>
<p>This is a small post for Linux new babies. Viewing folders can be achieved by two ways in linux/unix</p>
<ol>
<li><strong>Through ls command</strong></li>
<li><strong>Through find command</strong></li>
</ol>
<h3>With ls we have to use grep to get the directory listings..</h3>
<pre><strong>Ls –l &#124; grep ^d</strong></pre>
<p>Example</p>
<p><strong>[root@test surendra_a]# ls -l &#124; grep ^d</strong></p>
<p><strong>d&#8212;&#8212;&#8212; 2 surendra_a surendra_a 4096 Sep 8 09:54 HTWFAIP</strong></p>
<p><strong>drwxrwxr-x 2 surendra_a root 4096 Nov 27 12:30 LinuxCBT </strong>&#8230; <a href="http://www.linuxnix.com/2012/05/view-directories-linux.html" class="read_more">Continue Reading</a></p>]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;">How to view/list only directories in Linux?</span></h1>
<p>This is a small post for Linux new babies. Viewing folders can be achieved by two ways in linux/unix</p>
<ol>
<li><strong>Through ls command</strong></li>
<li><strong>Through find command</strong></li>
</ol>
<h3>With ls we have to use grep to get the directory listings..</h3>
<pre><strong>Ls –l | grep ^d</strong></pre>
<p>Example</p>
<p><strong>[root@test surendra_a]# ls -l | grep ^d</strong></p>
<p><strong>d&#8212;&#8212;&#8212; 2 surendra_a surendra_a 4096 Sep 8 09:54 HTWFAIP</strong></p>
<p><strong>drwxrwxr-x 2 surendra_a root 4096 Nov 27 12:30 LinuxCBT &#8211; RHEL5</strong></p>
<p><strong>drwxrwxr-x 2 surendra_a root 4096 Oct 12 16:40 Software</strong></p>
<h2>Through find command</h2>
<pre><strong>find . -type d</strong></pre>
<p>The above command will show you all the file types which are directories in present working directory.</p>
<div></div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxnix.com/2012/05/view-directories-linux.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Learn Linux/Unix Find command with 60+ Practical examples Part-II</title>
		<link>http://www.linuxnix.com/2012/04/learn-linuxunix-find-command-60-practical-examples-part-ii.html</link>
		<comments>http://www.linuxnix.com/2012/04/learn-linuxunix-find-command-60-practical-examples-part-ii.html#comments</comments>
		<pubDate>Tue, 24 Apr 2012 03:49:06 +0000</pubDate>
		<dc:creator>Surendra Anne</dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[find command]]></category>
		<category><![CDATA[linux find command]]></category>

		<guid isPermaLink="false">http://www.linuxnix.com/?p=1417</guid>
		<description><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;"><strong>Advanced finds command usages</strong></span></h1>
<h2 style="text-align: center;"><span style="color: #ff0000;"><strong>Playing with basics find command options</strong></span></h2>
<p><strong>For basic Linux Find command usage please <a href="http://www.linuxnix.com/2012/04/learn-linuxunix-find-command-50-practical-examples-part-i.html" target="_blank">click here</a></strong> <strong>Example31:</strong>find all the files which are with more than size 100MB and less than 1GB and the owner of the file is xyz and the file name is Adda.txt in /red folder</p>
<pre><strong>find /red –size +100M –size -1G –user xyz –iname adda.txt</strong></pre>
<p><strong>Example32:</strong>find all the files with SGID for the group sales and with &#8230; <a href="http://www.linuxnix.com/2012/04/learn-linuxunix-find-command-60-practical-examples-part-ii.html" class="read_more">Continue Reading</a></p>]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;"><strong>Advanced finds command usages</strong></span></h1>
<h2 style="text-align: center;"><span style="color: #ff0000;"><strong>Playing with basics find command options</strong></span></h2>
<p><strong>For basic Linux Find command usage please <a href="http://www.linuxnix.com/2012/04/learn-linuxunix-find-command-50-practical-examples-part-i.html" target="_blank">click here</a></strong> <strong>Example31:</strong>find all the files which are with more than size 100MB and less than 1GB and the owner of the file is xyz and the file name is Adda.txt in /red folder</p>
<pre><strong>find /red –size +100M –size -1G –user xyz –iname adda.txt</strong></pre>
<p><strong>Example32:</strong>find all the files with SGID for the group sales and with size exactly 100MB with file name as pass.txt under /opt</p>
<pre><strong>find /opt –size 100M –group sales –perm g+s –name pass.txt</strong></pre>
<h2 style="text-align: center;"><span style="color: #ff0000;"> Linux find command AND Operator</span></h2>
<p>By default find command will use <strong>AND option</strong> between two options. No need of mentioning any option. For example see below examples.</p>
<p><strong>Example33: </strong>find all the files which are more than 100MB and less than 1GB in size.</p>
<pre><strong>find / -size +100M –size -1G</strong></pre>
<p>or</p>
<pre><strong>find / -size +100M -a -size -1G</strong></pre>
<p>Like above we can combine many options and your find command use AND operator by default no need of mentioning -a option.</p>
<h2 style="text-align: center;"><span style="color: #ff0000;"><strong>Search for files and execute commands on Found files</strong></span></h2>
<p><span style="color: #ff6600;"><strong>Caution: Be careful when using -exec option which you are going to learn below. This is very dangerous option which can change/remove anything if don&#8217;t use wisely.</strong></span> There are some instances when you want to execute commands on the found files with find command. <strong>-exec</strong> is the option used in find command to execute shell commands directly on found files. Let’s discuss this with a basic example.</p>
<p><strong>Example34:</strong>find a file with passwd.txt in /var folder and long list this file for checking file properties.</p>
<pre><strong>find /var –iname passwd.txt –exec ls –l {} \;</strong></pre>
<p>Let me explain above command. Up to find /var –iname passwd.txt, this command you are aware. This command will search for passwd.txt file in /var folder and give the paths and file names where this file is located.</p>
<p><strong>-exec:</strong> with this option we are saying to find command to execute a command(here its ls -l) followed by this option</p>
<p><strong>{}</strong> –This is used as input to the command which we get as files/folders from find command output.</p>
<p><strong>\;</strong> &#8211;This indicates that find command is completed.</p>
<p>Actually ; is a command chaining capability and it’s a special character. In order to negate this special character we are using \ before;.</p>
<p><strong>Example35: </strong>Find all the files with name test.txt in /mnt and change the ownership of the files from Surendra to Narendra</p>
<pre><strong>find /mnt –user surendra –name test.txt –exec chown narendra: {} \;</strong></pre>
<p><strong>-exec command {} \;</strong> &#8211;for executing a command on find files <strong>-inum</strong> -For finding a file with inode number</p>
<p><strong>Example36:</strong>Find all the files with name test.sh in /abc folder and then grep if for word is there in that file or not</p>
<pre><strong>find /abc –name test.sh –exec grep ‘for’ {} \;</strong></pre>
<p><strong>chmod, grep, ls, rm, mv, cp,md5sum</strong></p>
<p><strong>Example37: </strong>Find all the files with name xyz.txt owned by Surendra in /var/ftp/pub and change the permissions to 775 to them.</p>
<pre><strong>find /var/ftp –user surendra –name xyz.txt –exec chmod 775 {} \;</strong></pre>
<p><strong>Example 38:</strong>Find all the files with name temp.txt in /xyz folder and backup then compress them to send it for saving</p>
<pre><strong>Find /xyz –name xyz.txt –exec tar xvfz temp.tar.gz {} \;</strong></pre>
<p><strong>Example39:</strong>Find files with name abc.txt in /home directory and take backup of each file before modifying it.</p>
<pre><strong>find /home –name abc.txt –exec cp {} {}.bkf \;</strong></pre>
<p>This above command will create files with .bkf extension whenever it finds abc.txt file.</p>
<p><strong>Example40:</strong>Find files which are more than 1GB and not accessed for the past 6 months and delete them.</p>
<pre><strong>find / -size +1G -mtime +180 –exec rm –rf {} \;</strong></pre>
<p><strong>Example41</strong>:Find all the files with executable permissions and display their checksum value</p>
<pre><strong>find / -perm /a=x -exec md5sum {} \;</strong></pre>
<p><strong>Example42:</strong>find all the files with name abc.txt and owner as surendra then move them to /opt folder</p>
<pre><strong>find / -user surendra -name abc.txt -exec mv {} /opt/ \;</strong></pre>
<p>There are many other commands you can try your own. Some other commands which can work with –exec option is mv, md5sum etc.</p>
<h3 style="text-align: center;"><span style="color: #ff0000;"><strong>Find command with multiple -exec option</strong></span></h3>
<p>Find command is capable of using multiple times using the same option(We seen it for finding files which are more than 200M and less then 1GB). In our previous examples we used –size to mention the size between two sizes. Similarly we can use –exec command multiple times.</p>
<p><strong>Example43:</strong>Find files with abc.txt name in /opt directory change the owner permissions from Surendra to Narendra and change the permissions to 775</p>
<pre><strong>find /opt –user Surendra –name abc.txt –exec chown Narendra: {} \; -exec chmod 775 {} \;</strong></pre>
<p><strong>Note: We can use this multiple –exec option more than two times.</strong></p>
<h2 style="text-align: center;"><span style="color: #ff0000;"><strong>Search for multiple files</strong></span></h2>
<p>Till this point if you observe we just search for single file. But sometimes there is a requirement to search for multiple files with single find command to save some valuable time. The following two examples we will see how to do that. <strong>Example44: </strong>Find all the commands which ends with .sh file extension in /opt folder</p>
<pre><span style="color: #ff0000;"><strong>find /opt –name *.sh</strong></span></pre>
<p><strong>Note:</strong> Sometimes the above command will not work properly because your shell will try to parse the * before find command is executed. So you have made * as not a special character or wild character. In order to understand more about this type of characters you have to learn RegExp. Please find our other posts on<strong> <a href="http://www.linuxnix.com/2011/08/grep-command-regular-expressions-examples-ii.html" target="_blank">Basic RegExp</a></strong> and <strong><a href="http://www.linuxnix.com/2011/08/grep-command-regular-expressions-examples-iii.html" target="_blank">Advanced RegExp</a>.</strong></p>
<p><strong>Example45:</strong></p>
<pre><strong>find /opt –name \*.sh</strong></pre>
<p>Or</p>
<pre><strong>find /opt –name “*.sh”</strong></pre>
<p>Note: These two will work, because you negated your shell parsing * wild character.</p>
<p><strong>Example46:</strong>Search for all the files which start with abc and ends with different extension in /opt folder</p>
<pre><strong>find /opt –name abc.\*</strong></pre>
<p><strong>Example47:</strong>Search for files which start with red and ends with many names such as redhat, redtop, redsoap etc.</p>
<pre><strong>find / -name red\*</strong></pre>
<p><strong>Example 48:</strong>How about search for files which always end with dump.</p>
<pre><strong>find / -name \*dump</strong></pre>
<h2 style="text-align: center;"><span style="color: #ff0000;"><strong>Search for files in multiple locations</strong></span></h2>
<p><strong>Search multiple locations using single find command</strong> We can accomplish searching multiple folders with single command without any options. Lets see below command.</p>
<p><strong>Example49: </strong>Find abc.txt file in /opt and /var folder at a time</p>
<pre><strong>find /opt /var –name abc.txt</strong></pre>
<p>The above command will search in only two locations i.e. in /opt and /var <strong>Search multiple locations but not in particular location.</strong> <strong>Example50:</strong>Search in entire system expect /proc folder</p>
<pre><strong>find / -path /proc -prune -name cpuinfo</strong></pre>
<p>Let me explain above command. The -path variable to define the path of a location. And -prune combined with -path will say not to descend in to the mention path /proc</p>
<p><strong>Example51</strong>:Search for abc.txt in /opt and /var expect in /var/tmp folder</p>
<pre><strong>find /opt /var -path /var/tmp -prune -name abc.txt</strong></pre>
<h2 style="text-align: center;"><span style="color: #ff0000;">Find command OR –o operator</span></h2>
<p>Find have OR operator to do multiple file searches at a time.</p>
<p><strong>Example52:</strong>I want to search for abc.txt and hash.c file at a time. This can be achieved by using -o operator</p>
<pre><strong>find / -name abc.txt -o -name hash.</strong>c</pre>
<p>Here when ever find command sees -o it just or the options on its left and right hand side.</p>
<p><strong>Example53:</strong>How about i want to find two directories say opt and var how can i find them?</p>
<pre><span style="color: #ff0000;"><strong>find / -type d - name opt -o -type d -name var </strong></span></pre>
<p>This above command may trow error. Try below syntax</p>
<pre><strong>find / -type d \( -name opt -o -name var \)</strong></pre>
<p>let me explain above command. () are used to combine two or more options in to one. So \( -name opt -o -name var \) are combined in to single option and are treated as directories as we given -type is d. We will see more about this operator in our coming post on find command advanced usage.</p>
<h2 style="text-align: center;"><span style="color: #ff0000;">Linux find command ! Negation operator</span></h2>
<div><strong> Example54:</strong> Negation operator is useful for negating a search team. for example we want to find all the files with name abc.txt which don&#8217;t have 755 permissions</div>
<div></div>
<pre><strong>find . -type f ! -perm 755 -name abc.txt</strong></pre>
<div></div>
<div>In above command -perm 755 is negated so that all the files with name abc.txt is displayed expect file abc.txt with permissions 755.</div>
<div>Stay tuned our next tutorial on find command to do following things</div>
<div></div>
<div>1)Dont search in .cvs folder</div>
<div>2)Search for files with out owner</div>
<div>3)Search for zero size files</div>
<div>4)Search for files and don&#8217;t show me permission denied error</div>
<div>5)Searching in hidden folders</div>
<div>6)Creating alias for frequently used find commands</div>
<div>7)Search for files with spaces</div>
<div>8)Search for files and grep for multiple pattern in one find command.</div>
<div>9) Miscellaneous examples</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxnix.com/2012/04/learn-linuxunix-find-command-60-practical-examples-part-ii.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learn Linux/Unix Find command with 60+ Practical examples Part-I</title>
		<link>http://www.linuxnix.com/2012/04/learn-linuxunix-find-command-50-practical-examples-part-i.html</link>
		<comments>http://www.linuxnix.com/2012/04/learn-linuxunix-find-command-50-practical-examples-part-i.html#comments</comments>
		<pubDate>Fri, 20 Apr 2012 19:33:39 +0000</pubDate>
		<dc:creator>Surendra Anne</dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[find command]]></category>
		<category><![CDATA[linux find command]]></category>

		<guid isPermaLink="false">http://www.linuxnix.com/?p=1413</guid>
		<description><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;">60+ Practical find commands examples with explanation</span></h1>
<p style="text-align: center;"><strong>find command</strong> is very much powerful command which can do good work when its needed to find files with conditions. Find command  is useful when finding files with complex requirement such as size, permissions etc. Suppose we want to find a file which is a regular file and its size is more than 1GB and its accessed more than 90 days back and its owner is none and then delete it. This entire &#8230; <a href="http://www.linuxnix.com/2012/04/learn-linuxunix-find-command-50-practical-examples-part-i.html" class="read_more">Continue Reading</a></p>]]></description>
			<content:encoded><![CDATA[<h1 style="text-align: center;"><span style="color: #ff0000;">60+ Practical find commands examples with explanation</span></h1>
<p style="text-align: center;"><strong>find command</strong> is very much powerful command which can do good work when its needed to find files with conditions. Find command  is useful when finding files with complex requirement such as size, permissions etc. Suppose we want to find a file which is a regular file and its size is more than 1GB and its accessed more than 90 days back and its owner is none and then delete it. This entire requirement is done with single command without even writing a<strong> shell script</strong>. Let’s see how we can use find command from basics to advanced in this post.</p>
<p>find command can find files according to</p>
<pre><strong>1) File names</strong>

<strong>2) File types</strong>

<strong>3) Permissions</strong>

<strong>4) Owners</strong>

<strong>5) Modified date and time</strong>

<strong>6) Size</strong><strong> </strong></pre>
<p><strong>Advanced finds command usages</strong></p>
<pre><strong>1) Mix of all the above things</strong>
<strong>2) AND operator</strong>
<strong>3) Search for files and execute commands on them</strong>
<strong>         <wbr>  a) chown, chmod, grep, ls, rm, mv, cp,md5sum</wbr></strong>

<strong>4) Multiple execute commands</strong>

<strong>5) Search for multiple files</strong>
<strong>          <wbr>  a) With different files with same extension</wbr></strong>
<strong>          <wbr>  b) Same file With different extensions</wbr></strong>
<strong>6) Search in multiple locations</strong>
<strong>          <wbr>  a) Exclude one location</wbr></strong>
<strong>          <wbr>  b) Search in multiple locations</wbr></strong>
<strong>         </strong>
<strong>7) OR( –o ) operator</strong></pre>
<pre><strong> <img src='http://www.linuxnix.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> ! Negation operator</strong></pre>
<pre><strong>9) Linux find command with Regular Expressions</strong></pre>
<pre><strong>10) Linux find commnd practical examples</strong></pre>
<h2 style="text-align: center;"><span style="color: #ff0000;"><strong>Basics of file/folders search using find command</strong></span></h2>
<h2 style="text-align: center;"> <span style="color: #ff0000;">find files with name</span></h2>
<p><strong>Syntax:</strong></p>
<pre><strong>find path options filename</strong></pre>
<p><strong>Example1:</strong> find all the files in /home with name test.txt. Here –name is used to specify the filename.</p>
<pre><strong>find /home –name test.txt</strong></pre>
<p><strong>Example2:</strong> find the files whose name is test.txt and in present working directory</p>
<pre><strong>find . –name test.txt</strong></pre>
<p>Or</p>
<pre><strong>find –name test.txt</strong></pre>
<p><strong>Example3:</strong> find all the files whose name contains both capital letters and small letters in it.</p>
<pre><strong>find /home –iname test.txt</strong></pre>
<p><strong>-iname</strong> option is used to mention ignore the case sensitivity of a file.</p>
<p>Search for files depending on their File types:</p>
<p><strong>Example4:</strong> Search for only directories whose name is var in / directory</p>
<pre><strong>find / -type d –name var</strong></pre>
<p><strong>Example5:</strong> Search for an mp3 files whose name is temp.mp3</p>
<pre><strong>find / -type f –name temp.mp3</strong></pre>
<p>Below are <strong><a href="http://www.linuxnix.com/2010/02/file-types-in-linux.html" target="_blank">the file types </a></strong>supported by find command, to know more about file types in Linux/Unix please have a look at our other post on File types.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="229"><strong>Sl.no</strong></td>
<td valign="top" width="229"><strong>Symbol</strong></td>
<td valign="top" width="229"><strong>Type</strong></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="229"><strong>1</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>f</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>Regular file</strong></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="229"><strong>2</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>d</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>Directory file</strong></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="229"><strong>3</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>b</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>Block file</strong></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="229"><strong>4</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>c</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>Character file</strong></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="229"><strong>5</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>p</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>Pipe file</strong></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="229"><strong>6</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>l</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>Symbolic link file</strong></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="229"><strong>7</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>s</strong></td>
<td style="text-align: center;" valign="top" width="229"><strong>Socket file.</strong></td>
</tr>
</tbody>
</table>
<h2 style="text-align: center;"><span style="color: #ff0000;"><strong>Search for files depending on their Permissions</strong></span></h2>
<p><strong>Example6:</strong>Search for a file name test.txt and its permissions are 775 in a given box</p>
<pre><strong>find / -perm 775 –name test.txt</strong></pre>
<p><strong>Example7:</strong> How about searcing files with SUID bit set and file permissions are 755?</p>
<pre><strong>find / -perm 4755</strong></pre>
<p><strong>Example8:</strong>How can i find SGID bit set files with 644 permissions?</p>
<pre><strong>find / -perm 2644</strong></pre>
<p><strong>Example9:</strong> How can i find Sticky bit set files in my system with permissions 551?</p>
<pre><strong>find / -perm 1551</strong></pre>
<p><strong>Example10:</strong>Search for all the files whose SUID bit is set</p>
<pre><strong>find / -perm /u=s</strong></pre>
<p><strong>Example11:</strong> Search for all the files whose SGID bit is set</p>
<pre><strong>find / -perm /g+s</strong></pre>
<p><strong>Note:</strong> We can use = or + interchangeably to check if a permissions is set or not as shown in above two examples.</p>
<p><strong>Example12:</strong> Search for all the files  whose StickyBit is set</p>
<pre><strong>find / -perm /o=t</strong></pre>
<p><strong>Example13:</strong> Search for all the files whose owener permissions is read only.</p>
<pre><strong>find / -perm /u=r</strong></pre>
<p><strong>Example14</strong>:Search for all the files which have user, group and others with executable permissions</p>
<pre><strong>find / -perm /a=x</strong></pre>
<p>To know about more on the permissions you have look at our other posts on <strong><a href="http://www.linuxnix.com/2011/10/chmod-command-explained-linuxunix.html" target="_blank">chmod command</a>.</strong></p>
<h2 style="text-align: center;"><span style="color: #ff0000;"><strong>Search according to Owners and group owners.</strong></span></h2>
<p><strong>Example15:</strong> Search for all the files with name test.txt and the owner of this file is Surendra</p>
<pre><strong>find / -user Surendra –name test.txt</strong></pre>
<p><strong>Example16:</strong> find all the files whos name is test.txt and owned by a group called redcluster</p>
<pre><strong>find / -group redcluster –name test.txt</strong></pre>
<p>to know more about owners and groups you have to look at our previous post on <strong><a href="http://www.linuxnix.com/2011/12/chown-command-linuxunix-explained-examples.html" target="_blank">chown command</a>.</strong></p>
<h2 style="text-align: center;"><span style="color: #ff0000;"><strong>Search according to Modified date and time.</strong></span></h2>
<p>Below is the matrix which give you brief idea on how to search according to modified date, accessed <strong>date</strong> etc.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="172"><strong>Sl. No</strong></td>
<td valign="top" width="172"><strong>-ctime</strong></td>
<td valign="top" width="172"><strong>-mtime</strong></td>
<td valign="top" width="172"><strong>-atime</strong></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="172"><strong>+90</strong></td>
<td valign="top" width="172"><strong>File status changed more then 90 days back</strong></td>
<td valign="top" width="172"><strong>Modified more than 90 days back</strong></td>
<td valign="top" width="172"><strong>Accessed more than 90 days back</strong></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="172"><strong>90</strong></td>
<td valign="top" width="172"><strong>File status changed exactly 90 days back</strong></td>
<td valign="top" width="172"><strong>Modified exactly 90 days back</strong></td>
<td valign="top" width="172"><strong>Accessed exactly 90 days back</strong></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="172"><strong>-90</strong></td>
<td valign="top" width="172"><strong>File status changed less than 90 days</strong></td>
<td valign="top" width="172"><strong>Modified less than 90 days</strong></td>
<td valign="top" width="172"><strong>Accessed less than 90 days back</strong></td>
</tr>
</tbody>
</table>
<p><strong>Example17:</strong> Search for a file: test.txt whose file status is changed more than 90 days back</p>
<pre><strong>find / -ctime +90 –name test.txt</strong></pre>
<p><strong>Example18:</strong> Search for all the files which are modified exactly 90 days back</p>
<pre><strong>find / -mtime 90</strong></pre>
<p><strong>Example19:</strong> Search for all the files with name test.txt which is accessed less than 90 days</p>
<pre><strong>find / -atime -90</strong></pre>
<p><strong>Example20: </strong>find all the files which are modified more than 90 days back and less than 180 days</p>
<pre><strong>find / -mtime +90 –mtime -180</strong></pre>
<p>Below is the matrix which gives you brief idea on how to search according to modified time, accessed <strong>time in minutes</strong> etc.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="172"><strong>Sl. No</strong></td>
<td valign="top" width="172"><strong>-cmin</strong></td>
<td valign="top" width="172"><strong>-mmin</strong></td>
<td valign="top" width="172"><strong>-amin</strong></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="172"><strong>+30</strong></td>
<td valign="top" width="172"><strong>File status changed more then 30 mins back</strong></td>
<td valign="top" width="172"><strong>Modified more than 30 mins back</strong></td>
<td valign="top" width="172"><strong>Accessed more than 30 mins back</strong></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="172"><strong>30</strong></td>
<td valign="top" width="172"><strong>File status changed exactly 30 mins back</strong></td>
<td valign="top" width="172"><strong>Modified exactly 30 days back</strong></td>
<td valign="top" width="172"><strong>Accessed exactly 30 mins back</strong></td>
</tr>
<tr>
<td style="text-align: center;" valign="top" width="172"><strong>-30</strong></td>
<td valign="top" width="172"><strong>File status changed less than 30 mins</strong></td>
<td valign="top" width="172"><strong>Modified less than 30 mins</strong></td>
<td valign="top" width="172"><strong>Accessed less than 30 mins</strong></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong>Example21: </strong>find all the files changed less than 30mins</p>
<pre><strong>find / -cmin -30</strong></pre>
<p><strong>Example22:</strong> find all the files modified exactly 30 mins back</p>
<pre><strong>find / -mmin 30</strong></pre>
<p><strong>Example23:</strong> find all the files accessed more than 30 mins back</p>
<pre><strong>find / -amin +30</strong></pre>
<p><strong>Example24:</strong> find all the files which are modified more than 5mins back and less than 25mins</p>
<pre><strong>find / -mmin +5 –mmin -25</strong></pre>
<p><strong>Example25:</strong> I have new file called test.txt which is just created, now I want to get all the files which are created later this file creation.</p>
<pre><strong>find / -newer test.txt</strong></pre>
<h2 style="text-align: center;"><span style="color: #ff0000;"><strong>Search for files/folders depending on the size with –size option</strong></span></h2>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="121"><strong>Sl.no</strong></td>
<td valign="top" width="132"><strong>+10</strong></td>
<td valign="top" width="120"><strong>10</strong></td>
<td valign="top" width="126"><strong>-10</strong></td>
</tr>
<tr>
<td valign="top" width="121"><strong>c for bytes(8 bits)</strong></td>
<td valign="top" width="132"><strong>Search for files more than 10c size</strong></td>
<td valign="top" width="120"><strong>Search for files exactly 10b size</strong></td>
<td valign="top" width="126"><strong>Search for files less than 10b size</strong></td>
</tr>
<tr>
<td valign="top" width="121"><strong>k for kilobytes</strong></td>
<td valign="top" width="132"><strong>Search for files more than 10k size</strong></td>
<td valign="top" width="120"><strong>Search for files exactly 10k size</strong></td>
<td valign="top" width="126"><strong>Search for files less than 10k size</strong></td>
</tr>
<tr>
<td valign="top" width="121"><strong>M for Megabytes</strong></td>
<td valign="top" width="132"><strong>Search for files more than 10M size</strong></td>
<td valign="top" width="120"><strong>Search for files exactly 10M size</strong></td>
<td valign="top" width="126"><strong>Search for files less than 10M size</strong></td>
</tr>
<tr>
<td valign="top" width="121"><strong>G for Gigabytes</strong></td>
<td valign="top" width="132"><strong>Search for files more than 10G size</strong></td>
<td valign="top" width="120"><strong>Search for files exactly 10G size</strong></td>
<td valign="top" width="126"><strong>Search for files less than 10G size</strong></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong>Example26:</strong> Search for files whose size is more than 10bytes</p>
<pre><strong>find / -size +10c</strong></pre>
<p><strong>Example27:</strong> Search for files which are exactly 10kb in /opt folder</p>
<pre><strong>find /opt –size 10k</strong></pre>
<p><strong>Example28:</strong> Search for files which are less than 10MB in /var folder</p>
<pre><strong>find /var –size -10M</strong></pre>
<p><strong>Example29:</strong> Search for files which are more than 1GB size in /usr folder</p>
<pre><strong>find /usr –size +1G</strong></pre>
<p><strong>Example30:</strong> find all the empty files in my system</p>
<pre><strong>find / -size 0k</strong></pre>
<p>In next post on find command we will see more depth in to this find command. Please<strong> <a href="http://www.linuxnix.com/2012/04/learn-linuxunix-find-command-60-practical-examples-part-ii.html" target="_blank">click here</a></strong> for more advanced <strong>Linux Find command usage</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxnix.com/2012/04/learn-linuxunix-find-command-50-practical-examples-part-i.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 3.386 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-05-19 04:38:19 -->

