cd

What is cd?

cd (change directory), is implemented in every Linux distribution. This command-line tool is used to change from 1 directory to another.

Note that the main directory that is used is : /root

How to use cd

# syntax
cd <DIRECTORY>

##### change succesfully to another directory
cd Downloads  # success, changes to the directory Downloads
cd ./Downloads # success, changes to the directory Downloads
cd /root/Downloads # success, changes to the directory Downloads

##### try to change to another directory (failure)
cd /Downloads # gives an error, since the "root" is specified first (/)
cd root/Downloads # gives an error, since the "root" is not specified first (/)

##### extra commands cd 
cd - # changes back to the last directory you were in
cd ~ # change to the current users home directory

# TIP: 
# make use of the tab key when you don't know the full name of a file or directory

Last updated