Posted under » Linux on 28 September 2015
Sometimes navigating using the command line can be a pain because you have type in the directory names when you CD
To remember the directory, you do either
$ pushd . $ pushd /etc/apache2/sites-available
You can build this list by adding or pushing more.
To see the list of directories that you have stored.
$ dirs ~/Documents /usr/share ~/Music ~/Videos ~/Desktop ~ $ dirs -v 0 /var/tmp 1 /opt 2 ~/Music 3 ~/Videos 4 ~/Desktop 5 ~
Now that you have a nice list, to move to the Music folder
$ pushd +2
What the push +n does is bring you the Music folder and rearrange the index.
$ pwd ~/Music $ dirs -v 0 ~/Music 1 /var/tmp 2 /opt 3 ~/Videos 4 ~/Desktop 5 ~
You can move to the first directory and remove it from the list by the popd command.
$ popd
However, if you do not wish to be moved into the directory, delete the value and stay where you are, use
$ popd +2 $ dirs -v 0 ~/Music 1 /var/tmp 2 ~/Videos 3 ~/Desktop 4 ~