commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
if you cd into a directory then cd into another directory somewhere else then you run the cd - command you will go to the previous directory you was in!! To go back to the other directory just run it again. So if you are working in 2 different directories then this is the perfect command for you.
There are 5 alternatives - vote for the best!
as alternative to cd $OLDPWD
This is like `cd -` but doesn't echo the new directory name, which is preferable (to me) for an alias, e.g.
alias cdo="cd $OLDPWD"
If you can do better, submit your command here.
You must be signed in to comment.