How to switch between directories efficiently
Working on the Linux command line means switching between a lot of directories. Suppose you are in Directory ‘A’ and then move to Directory ‘B’. When you want to come back to Directory ‘A’, typing the complete directory path for ‘A’ can be cumbersome sometimes. Here’s a simple trick for this. You can use ‘cd -’ to go back to the last directory you were in. Let us see how this works by using an example: Your current working directory is:
As you can see, you first pass the desired directory (to which you want to come back to eventually) as the argument to ‘pushd’. Then through ‘popd’ you can actually trigger a directory switch to that directory from anywhere on the command prompt.
—Tushar Shah, tushar_shah06@yahoo.co.in