Navigating to the previous folder in bash

Lets say you’re in bash terminal and navigated to some folder:

[andrey@andrey bin]$ pwd
/home/andrey/Tools/jboss-4.2.3.GA/bin

And you go somewhere else

[andrey@andrey bin]$ cd /home/andrey/Sources/
[andrey@andrey Sources]$ pwd
/home/andrey/Sources

You can easily navigate to the previous folder by using command “cd -“

[andrey@andrey Sources]$ cd –
/home/andrey/Tools/jboss-4.2.3.GA/bin
[andrey@andrey bin]$ pwd
/home/andrey/Tools/jboss-4.2.3.GA/bin

Such a small tip which can save you some time