<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: 6 Awesome Linux cd command Hacks &#8211; Productivity Tip#3 for Geeks</title>
	<atom:link href="http://www.thegeekstuff.com/2008/10/6-awesome-linux-cd-command-hacks-productivity-tip3-for-geeks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thegeekstuff.com/2008/10/6-awesome-linux-cd-command-hacks-productivity-tip3-for-geeks/</link>
	<description>Guides, HowTos and Tips for Technology Geeks</description>
	<lastBuildDate>Thu, 09 Feb 2012 13:04:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Satya Prakash</title>
		<link>http://www.thegeekstuff.com/2008/10/6-awesome-linux-cd-command-hacks-productivity-tip3-for-geeks/comment-page-1/#comment-128050</link>
		<dc:creator>Satya Prakash</dc:creator>
		<pubDate>Mon, 19 Sep 2011 13:11:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=233#comment-128050</guid>
		<description>Superb tricks. You are the Linux guru.</description>
		<content:encoded><![CDATA[<p>Superb tricks. You are the Linux guru.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norbert V</title>
		<link>http://www.thegeekstuff.com/2008/10/6-awesome-linux-cd-command-hacks-productivity-tip3-for-geeks/comment-page-1/#comment-117814</link>
		<dc:creator>Norbert V</dc:creator>
		<pubDate>Sat, 16 Jul 2011 00:45:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=233#comment-117814</guid>
		<description>In recent bash versions, there are 
shopt -s autocd # will automatically cd if only a dir is given
and 
shopt -s cdable_vars # will let you cd into a variable

This will enable:
doc@desktop:~$ shopt -s autocd cdable_vars ; foo=&quot;/tmp&quot;; $foo
cd /tmp

So you can just type your $var and will be taken to the directory $var represents.
Useful for stuff like $gitrepo, $rpmbuild, $sources and so on.

Remember to use lowercase variable names to avoid accidential overriding of environment variables.</description>
		<content:encoded><![CDATA[<p>In recent bash versions, there are<br />
shopt -s autocd # will automatically cd if only a dir is given<br />
and<br />
shopt -s cdable_vars # will let you cd into a variable</p>
<p>This will enable:<br />
doc@desktop:~$ shopt -s autocd cdable_vars ; foo=&#8221;/tmp&#8221;; $foo<br />
cd /tmp</p>
<p>So you can just type your $var and will be taken to the directory $var represents.<br />
Useful for stuff like $gitrepo, $rpmbuild, $sources and so on.</p>
<p>Remember to use lowercase variable names to avoid accidential overriding of environment variables.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug W</title>
		<link>http://www.thegeekstuff.com/2008/10/6-awesome-linux-cd-command-hacks-productivity-tip3-for-geeks/comment-page-1/#comment-107626</link>
		<dc:creator>Doug W</dc:creator>
		<pubDate>Fri, 03 Jun 2011 17:29:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=233#comment-107626</guid>
		<description>Rather than re-logging in after creating the function in .bashrc it&#039;s much easier to just enter &#039;. .bashrc&#039; (the dot is short for the &quot;source&quot; command).</description>
		<content:encoded><![CDATA[<p>Rather than re-logging in after creating the function in .bashrc it&#8217;s much easier to just enter &#8216;. .bashrc&#8217; (the dot is short for the &#8220;source&#8221; command).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chandra</title>
		<link>http://www.thegeekstuff.com/2008/10/6-awesome-linux-cd-command-hacks-productivity-tip3-for-geeks/comment-page-1/#comment-101929</link>
		<dc:creator>chandra</dc:creator>
		<pubDate>Sat, 30 Apr 2011 17:38:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=233#comment-101929</guid>
		<description>When i m trying jump to directories above using alias i am getting the following error:
&quot;-bash: alias: .....: not found&quot;
&quot;-bash: alias: cd: not found&quot;
Could some one suggest me? Thanks.</description>
		<content:encoded><![CDATA[<p>When i m trying jump to directories above using alias i am getting the following error:<br />
&#8220;-bash: alias: &#8230;..: not found&#8221;<br />
&#8220;-bash: alias: cd: not found&#8221;<br />
Could some one suggest me? Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Beginner&#8217;s Guide to The Geek Stuff &#8211; A Guided Tour</title>
		<link>http://www.thegeekstuff.com/2008/10/6-awesome-linux-cd-command-hacks-productivity-tip3-for-geeks/comment-page-1/#comment-27683</link>
		<dc:creator>The Beginner&#8217;s Guide to The Geek Stuff &#8211; A Guided Tour</dc:creator>
		<pubDate>Tue, 29 Dec 2009 15:10:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=233#comment-27683</guid>
		<description>[...] 6 Awesome Linux cd command Hacks – Productivity Tip#3 for Geeks [...]</description>
		<content:encoded><![CDATA[<p>[...] 6 Awesome Linux cd command Hacks – Productivity Tip#3 for Geeks [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Coward</title>
		<link>http://www.thegeekstuff.com/2008/10/6-awesome-linux-cd-command-hacks-productivity-tip3-for-geeks/comment-page-1/#comment-17718</link>
		<dc:creator>Robert Coward</dc:creator>
		<pubDate>Wed, 23 Sep 2009 15:18:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=233#comment-17718</guid>
		<description>Beware that this forum is apparently susceptible to browser security hacks. In my previous post, I used angle brackets (less than and greater than symbols) to outline the parameter to my up command, but your site interpreted these as HTML tags and they did not appear. So my text should have read something like &quot;up number to step up number of levels&quot;, where number was encased in these brackets.

Since the site seems to interpret raw text as HTML, I can imagine that it would be possible to embed all sorts of nasties in here. In my opinion, anything entered on forums should be interpreted as raw text and displayed as such.</description>
		<content:encoded><![CDATA[<p>Beware that this forum is apparently susceptible to browser security hacks. In my previous post, I used angle brackets (less than and greater than symbols) to outline the parameter to my up command, but your site interpreted these as HTML tags and they did not appear. So my text should have read something like &#8220;up number to step up number of levels&#8221;, where number was encased in these brackets.</p>
<p>Since the site seems to interpret raw text as HTML, I can imagine that it would be possible to embed all sorts of nasties in here. In my opinion, anything entered on forums should be interpreted as raw text and displayed as such.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Coward</title>
		<link>http://www.thegeekstuff.com/2008/10/6-awesome-linux-cd-command-hacks-productivity-tip3-for-geeks/comment-page-1/#comment-17649</link>
		<dc:creator>Robert Coward</dc:creator>
		<pubDate>Tue, 22 Sep 2009 16:47:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=233#comment-17649</guid>
		<description>Regarding changing up directory levels in Linux, here&#039;s the method I use all the time. First, I define a shell script called upl somewhere on my path:

#!/bin/bash
if [ $1 ]
then
	steps=$1
else
	steps=1
fi
while [ $steps -gt 0 ]
do
	cd ..
	(( steps = steps - 1 ))
done
pwd

Then, I add the following line to my .bashrc:

alias up=&quot;source upl&quot;

Then, wherever I am, it&#039;s simply a metter of typing &quot;up&quot; to just go up one level, or &quot;up &quot; to step up  of levels. So if I&#039;m 8 levels doen in a massive source tree, typing &quot;up 8&quot; will immediatley jump up 8 levels, and print the new directory where I am. In this way, I can roughly guess how many levels I need to step up, and fine tune if afterwards, if required.

While extremely noddy, this simple script saves so much hassle ,and I really think something like it should be standard in the Linux command shell.</description>
		<content:encoded><![CDATA[<p>Regarding changing up directory levels in Linux, here&#8217;s the method I use all the time. First, I define a shell script called upl somewhere on my path:</p>
<p>#!/bin/bash<br />
if [ $1 ]<br />
then<br />
	steps=$1<br />
else<br />
	steps=1<br />
fi<br />
while [ $steps -gt 0 ]<br />
do<br />
	cd ..<br />
	(( steps = steps &#8211; 1 ))<br />
done<br />
pwd</p>
<p>Then, I add the following line to my .bashrc:</p>
<p>alias up=&#8221;source upl&#8221;</p>
<p>Then, wherever I am, it&#8217;s simply a metter of typing &#8220;up&#8221; to just go up one level, or &#8220;up &#8221; to step up  of levels. So if I&#8217;m 8 levels doen in a massive source tree, typing &#8220;up 8&#8243; will immediatley jump up 8 levels, and print the new directory where I am. In this way, I can roughly guess how many levels I need to step up, and fine tune if afterwards, if required.</p>
<p>While extremely noddy, this simple script saves so much hassle ,and I really think something like it should be standard in the Linux command shell.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sandy miller</title>
		<link>http://www.thegeekstuff.com/2008/10/6-awesome-linux-cd-command-hacks-productivity-tip3-for-geeks/comment-page-1/#comment-9626</link>
		<dc:creator>sandy miller</dc:creator>
		<pubDate>Wed, 06 May 2009 09:00:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=233#comment-9626</guid>
		<description>A friend and myself have been arguing about an issue similar to this one! Now I know that I was right. lol! Thanks for the information you posted.</description>
		<content:encoded><![CDATA[<p>A friend and myself have been arguing about an issue similar to this one! Now I know that I was right. lol! Thanks for the information you posted.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samus_</title>
		<link>http://www.thegeekstuff.com/2008/10/6-awesome-linux-cd-command-hacks-productivity-tip3-for-geeks/comment-page-1/#comment-4905</link>
		<dc:creator>Samus_</dc:creator>
		<pubDate>Sun, 18 Jan 2009 22:38:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=233#comment-4905</guid>
		<description>agree with Sam however quotes are important there, I recommend this way:

    mcd() { mkdir -p &quot;$1&quot; &amp;&amp; cd &quot;$1&quot;; }

the latter won&#039;t have problems with spaces on the argument.

as for the cd alias, instead of defining several ones it might be better to use a function too:

    ..() {
        local levels=$1
        while ((levels &gt; 0)); do
            cd .. &#124;&#124; break
            let &quot;levels--&quot;
        done
    }

with this you&#039;ll do &quot;.. 3&quot; and it will go back three levels and you can use any number.</description>
		<content:encoded><![CDATA[<p>agree with Sam however quotes are important there, I recommend this way:</p>
<p>    mcd() { mkdir -p &#8220;$1&#8243; &amp;&amp; cd &#8220;$1&#8243;; }</p>
<p>the latter won&#8217;t have problems with spaces on the argument.</p>
<p>as for the cd alias, instead of defining several ones it might be better to use a function too:</p>
<p>    ..() {<br />
        local levels=$1<br />
        while ((levels &gt; 0)); do<br />
            cd .. || break<br />
            let &#8220;levels&#8211;&#8221;<br />
        done<br />
    }</p>
<p>with this you&#8217;ll do &#8220;.. 3&#8243; and it will go back three levels and you can use any number.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://www.thegeekstuff.com/2008/10/6-awesome-linux-cd-command-hacks-productivity-tip3-for-geeks/comment-page-1/#comment-2244</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Sun, 26 Oct 2008 19:18:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=233#comment-2244</guid>
		<description>Eval? What&#039;s wrong with function mcd(){ mkdir -p $* &amp;&amp; cd $* }</description>
		<content:encoded><![CDATA[<p>Eval? What&#8217;s wrong with function mcd(){ mkdir -p $* &amp;&amp; cd $* }</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Content Delivery Network via Amazon Web Services: CloudFront: static.thegeekstuff.com

Served from: www.thegeekstuff.com @ 2012-02-09 15:38:43 -->
