cd Linux Command Cheatsheet

801




cd command is used to change the current working directory

Changing to a directory with path

cd /path/to/new/directory

change directory to the root directory

 cd /

Change to current logged in user's home directory

cd ~
cd

Change to a directory whih is an immediatsub directy to you rcurrent directory

For example lets take following is your directory structure

├── images
├── movies
│   ├── action
│   └── comedy
└── music

and let's say you are in movies currently, so to go to action you can simply run the following command

cd action
├── images
├── 'My movies'
│   ├── action
│   └── comedy
└── music
cd My\ movies

Going back to immediate parent directoty of current directoty

cd ..

change directory to the last working directory

 cd -