cd – Change Directory

cd – Change the shell working directory.

cd [-L|-P] [dir]

Change the shell working directory. Change the current directory to DIR. The default DIR is the value of the HOME shell variable.

The variable CDPATH defines the search path for the directory containing DIR. Alternative directory names in CDPATH are separated by a colon (:).
A null directory name is the same as the current directory. If DIR begins with a slash (/), then CDPATH is not used.

If the directory is not found, and the shell option `cdable_vars’ is set, the word is assumed to be a variable name. If that variable has a value, its value is used for DIR.

-L force symbolic links to be followed
-P use the physical directory structure without following symbolic links

The default is to follow symbolic links, as if `-L’ were specified.

Exit Status:
Returns 0 if the directory is changed; non-zero otherwise

Usage of “cd” command

To Navigate to your home directory.
$ cd
$ cd ~

To Navigate previous working directory
$ cd –

To Navigate root directory
$ cd /

To Navigate to the home-related directory where ever you in another directory
$ cd ~/folder/path/

To change the current working directory
$ cd /folder/path/ 

To change the current directory to its parent directory
$ cd .. 

To change the current directory to its two parent directory
$ cd ../../

To change the working directory to the current working directory
$ cd .

To change directory which contains space
$ cd ‘test folder’ or $cd “test folder”
$ cd test\ folder/

***To change the working to a symbolic path
$ cd -P synbolic_link_name