Mark As Completed Discussion

cd

cd is a command to change directory. By providing a path along with this command, we can change the current directory to a different directory. This command does not give an output and only changes the directory. You can later use ls to display the directory contents to check that the current directory has been changed.

Syntax: cd[option]<directory>

SNIPPET
1user@localhost:~$ cd Documents
2user@localhost:~$ ls
3file1.txt 
4user@localhost:~$ cd ..
5user@localhost:~$ ls
6Documents Pictures Videos

In the above example, we used a shortcut .. to change back to the parent directory. This can be used several times in a single path to go up the hierarchy of parent directories. Of course, you can provide the entire path to the directory as well.