Artificial intelligent assistant

What is the bash shortcut to change to the previous directory? Sadly, I only learned about this last year by stumbling upon it randomly on the internet. I use it so infrequently that I always forget what it is by the time I need it again. How do you change to your previous directory?

The shortcut is `-`

Try `cd -`

If you want to use this in your prompt, you have to refer to it with `~-`.

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

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy b171faf903e9048173aebfd6f4d38fac