cd – changes the current working directory
Use the cd command to change to another directory.
The syntax is cd followed by the name of the directory you want to go to.
Example: cd /home/user/www will change the directory you are in to /home/user/www.
> cd /home/rich/www
Line 1 shows the command cd /home/rich/www, which should put me in the folder /home/rich/www
Line 2 is tthe pwd command (print working directory) to see if we are in the right directory
Line 3 is the output of the pwd command – which shows that we are indeed in /home/rich/www
Line 4 is the prompt again
Wildcards are also permitted.
Example: cd /home/ri*/www would also take you to /home/rich/www, assuming there was no other folder in /home beginning with ri.
You can also use ../ to move you up one level in the file structure, or ../../ to move up two levels etc.
Example 1: If you are in /home/rich/www, then cd ../ will take you to /home/rich, and ../../ will take you to /home.
Example 2: From /home/rich/www, cd ../../bob will take you to /home/bob