How to go back to a previous directory in Bash

1137035 pts.
Tags:
Bash
Linux
Would there be a way to actually go back to a previous directory that we were using in Bash, without using pushd/popd? We're hoping for something like "back" so it returns us back to the directory that we were previously in.
1

Answer Wiki

Thanks. We'll let you know when a new response is added.
Hi,
You will go back to the last dir with  cd –

See the example:
[echox@kaffeesatz ~]$ cd /tmp
[echox@kaffeesatz tmp]$ ls
cron.iddS32  serverauth.CfIgeXuvka
[echox@kaffeesatz tmp]$ cd –
/home/echox
[echox@kaffeesatz ~]$ ls ~-
cron.iddS32  serverauth.CfIgeXuvka
To get more info


Thanks & Regards
Clark Kent

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: