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

On March 8, 2010, in cd, toggle, by Dipin Krishna

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

*

Search