If you are a Terminal freak or use terminal to do most of your task, then it is obvious that you are frequently using cd Command to navigate from one directory to another. Here are some cd tricks which helps you to navigate much more faster and will boost your productivity.
Trick 1:
Move to your home directory from anywhere: cd (without any argument) and cd ~ (Tilda) commands are used to move to user's home directory from any directory in the file system.$ pwd
/etc/apache2
$ cd
$ pwd
/home/sandeep
$ pwd
/etc/apache
$ cd ~
$ pwd
/home/sandeep
/etc/apache2
$ cd
$ pwd
/home/sandeep
$ pwd
/etc/apache
$ cd ~
$ pwd
/home/sandeep
Trick 2:
Toggle between last two directories: cd - (minus) command is used to toggle between last two visited directories.$ pwd
/home/sandeep
$ cd /etc/apache2
$ pwd
/etc/apache2
$ cd -
$ pwd
/home/sandeep
$ cd -
$ pwd
/etc/apache2
/home/sandeep
$ cd /etc/apache2
$ pwd
/etc/apache2
$ cd -
$ pwd
/home/sandeep
$ cd -
$ pwd
/etc/apache2