cd command in linux known as change directory command. It is used to change current working directory.
Syntax:
$ cd [directory]
To move inside a subdirectory : to move inside a subdirectory in linux we use
$ cd [directory_name]

In the above example, we have checked number of directories in our home directory and moved inside the Documents directory by using cd Documents command.
Different functionalities of cd command :
- cd /: this command is used to change directory to the root directory, The root directory is the first directory in your filesystem hierarchy.
$ cd /

Above, / represents the root directory.
- cd dir_1/dir_2/dir_3: This command is used to move inside a directory from a directory
$ cd dir_1/dir_2/dir_3

In above example, we have the document directory and inside the document directory we have a directory named geeksforgeeks and inside that directory we have example directory. To navigate example directory we have used command cd Documents/geeksforgeeks/example. - cd ~ : this command is used to change directory to the home directory.
$ cd ~

or
$ cd
cd : this commad also work same as cd ~ command.

- cd .. : this command is used to move to the parent directory of current directory, or the directory one level up from the current directory. “..” represents parent directory.
$ cd ..

- cd “dir name”: This command is used to navigate to a directory with white spaces.Instead of using double quotes we can use single quotes then also this command will work.
$ cd "dir name"

In above example, we have navigated the My songs directory by using cd “My songs” command.
or
$ cd dir\ name :
this command work same as cd “dir name” command.

Recommended Posts:
- 'IPCS' command in Linux with examples
- select command in Linux with examples
- Sed Command in Linux/Unix with examples
- ZIP command in Linux with examples
- SORT command in Linux/Unix with examples
- Cat command in Linux with examples
- Head command in Linux with examples
- Tail command in Linux with examples
- wc command in Linux with examples
- tar command in Linux with examples
- atrm command in Linux with examples
- bc command in Linux with examples
- AWK command in Unix/Linux with examples
- tr command in Unix/Linux with examples
- mv command in Linux with examples
- Paste command in Linux with examples
- comm command in Linux with examples
- cmp Command in Linux with examples
- cut command in Linux with examples
- cp command in Linux with examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

