CoolComputing Logo
Coupons/Deals  ·  New Promo Codes/Coupons  · October 22, 2018

Go back to the last directory

Posted on Saturday, March 31, 2001 @ 09:37:03 PM CST by David Yee [] [read 3517 times]

Tips: Linux/Unix world
Sometimes after you cd to a different directory you might want to go back to the directory you were just in. There is an environment variable called OLDPWD that holds that information. This can come in handy especially if that directory is long. Instead of typing "cd path_to_old_directory" all you have to do is type "cd $OLDPWD". Even better you can make an alias of this to something shorter in your .bashrc, e.g.:

alias cdp='cd $OLDPWD'

Please rate this article or post a brief review of Go back to the last directory or comment on benchmark/performance, features, availability, price or anything else regarding Go back to the last directory. Thanks!

Go Back To The Last Directory Rating: 1.6/5 (8 votes cast)

Your Name:
I have read and agreed to the Review Posting Agreement.
Review Title:
dateComment #Article Comments
2001-04-03 18:01:226Ah, good point- I didn't know that. "cd -" is a bit more difficult to type, however ;-).
2001-04-03 06:40:085If you are using bash, you can use :
$ cd -
instead of cdp