Linux - return to the last folder
If you need to cd out of a folder you are so nicely nestled in and will need to go back, you might find yourself typing pwd and copying and pasting.
There is a nice little command in Linux (and Mac) that will drop you back into your last folder - saves the copying and pasting!
cd -Written by Mike Street
Related protips
4 Responses
See also pushd and popd.
over 1 year ago
·
@xtagon - I get a bash: pushd: no other directory and bash: popd: directory stack empty when using those two
over 1 year ago
·
Ahh, just worked out you used pushd instead of cd e.g.
pushd /home/user
pushd /home
popd #takes you back to /home/user
over 1 year ago
·
Yep. I use them so often I alias them:
alias pu='pushd'
alias up='popd'
You can also use the dirs command to see the stack.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#