cd command in Linux/Unix

cd is a Linux command to change the directory/folder of the terminal's shell.

You can press the tab button in order to auto complete the directory name.

cd syntax

$ cd [directory]

cd command examples

Change to home directory (determined by $HOME environment variable):

$ cd

 

Also change to home directory:

$ cd ~

 

Change to root directory:

$ cd /

 

Change to parent directory:

$ cd ..

 

Change to subdirectory Documents:

$ cd Documents

 

Change to subdirectory Documents/Books:

$ cd Documents/Books

 

Change to directory with absolute path /home/user/Desktop:

$ cd /home/user/Desktop

 

Change to directory name with white space - My Images:

$ cd My\ Images

Or

$ cd "My Images"

Or

$ cd 'My Images'

 


See also

Write how to improve this page