Taken from: http://www.howtogeek.com/272308/how-to-toggle-between-two-directories-in-linuxs-command-line/
Now, instead of typing the first directory name to go back to that directory, you can type the following command at the prompt and press Enter.
cd -
That’s simply the cd command followed by a space and then a dash. The name of the directory you’re toggling to displays and then you’re taken to that directory.

To toggle back to the second directory again, use the cd - command again.

You can also press the up arrow key once to access the last command used from the command line history, which in this case was cd -. So, at this point, to toggle back and forth between these two directories, all you do it press the up arrow key and Enter. That’s quicker than typing out the path each time, even when you use tab completion.