Skip to content
Blog Use “cd -” to toggle between the last two directories

Use “cd -” to toggle between the last two directories

You can toggle between the last two current directories using cd – as shown
below.

[dipin@linuxgeek ~]$ cd /etc/
[dipin@linuxgeek etc]$ pwd
/etc
[dipin@linuxgeek etc]$ cd /var/
[dipin@linuxgeek var]$ pwd
/var
[dipin@linuxgeek var]$ cd -
/etc
[dipin@linuxgeek etc]$ pwd
/etc
[dipin@linuxgeek etc]$

Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.