bash shell tip: cd -
cd - |
(That's a hyphen after the cd) you'll switch to the previous directory you were in. Type it again and you'll return to the directory you just left.
If I had known that five years ago, it would have saved me 10,000 hours of typing by now.
2 Comments:
At 10/27/2008 3:54 PM, butch said…
I like this command, but how do you suppress its displaying the directory you are going to.
Given that:
pwd is x/y/z
and I do "cd k"
then "cd -"
the command displays "x/y/z"
I do not want my script that uses "cd -" to display anyting.
How do you suppress the output?
At 10/27/2008 4:57 PM, Derek said…
Try:
cd - > /dev/null
Post a Comment
<< Home