cd Command in Linux

Back

cd command is used  to change the current directory to another directory.
By default ,the cd command will navigates you to your home directory . The ( ~ ) tilde is not required for that.
The syntax is cd followed by the name of the directory you want to go to.

Examples:

1) cd  /home/user/www will change the directory you are in to /home/user/www.


2) cd  /home/ri*/www would also take you to /home/rich/www, assuming there was no other folder in /home beginning with ri.

3) You can also use ../ to move you up one level in the file structure, or ../../ to move up two levels etc.

4) If you are in /home/rich/www, then cd ../ will take you to /home/rich, and ../../ will take you to /home.

 5) From /home/rich/www, cd ../../bob will take you to /home/bob.