cd command in Linux with examples

Hi Friends! Today we will learn about the cd command which is used to play with directories and folders. Its full form has the secret what this command do c(change) d(directory).

So, let’s start with the cd command which is mainly used to change the directory in Linux, Windows as well as Unix.

Kindly refer the link so you can practice with us while learning the POST, it will take 40 to 50 seconds to boot the image.

$ cd tastethelinux
[email protected]:~/tastethelinux$

so we have to change the directory successfully and moved into the folder tastethelinux

But are we in the right folder, so we will look for the new command known as “pwd”?

$ pwd

By using the pwd command we got that we are in /home/tla/tastethelinux folder.

pwd command stands for Present Working Directory, it always shows in which directory currently you are.

But what is /home/tla?

So, it is a home directory of the user tla lets see, how we can use with the cd command

So, from the above example, we can say that ~ this sign denotes the home directory of the user tla.

If we are anywhere in the directory we can use cd ~ to switch back to our home directory.

How to switch back to my working directory back tastethelinux use the command?

So, currently, we are in /home/tla/tastethelinux, and will go to the parent directory(means one step back)

[email protected]:~/tastethelinux$ cd ../
[email protected]:~$ pwd
[email protected]:~$

So, we have used “cd ../” command to go one step back.

What if we have to directly go to /home directory you can also use “cd ../../”

[email protected]:~/tastethelinux$ cd ../../
[email protected]:/home$

So, Guys that it for the cd command, if you want to learn mkdir command and ls command then visit this.

Let’s Play the Quiz Guys for the cd command, Are you ready to play with tastethelinux?


cd command is for?

Correct! Wrong!

Choose the correct syntax

Please select 3 correct answers

Correct! Wrong!

how you will go in /home/tla/tastethelinux/exam/quiz by using cd command

Please select 2 correct answers

Correct! Wrong!

instead of /home/tla you can use ~ as we have mentioned in the post also.

pwd command is used for?

Please select 2 correct answers

Correct! Wrong!

cd ../../../ how much step you will go back

Correct! Wrong!

Answer please for cd command
Thanks for the Participation in the Quiz!!
To Learn more Linux Basic command, Please visit to Basic Command Section.
cd cheat sheet
1. Switch the directory

cd [directory_name]

cd tastethelinux
2. Go to home directory

Syntax and Example:
cd ~
3. Switch back to the working directory

Syntax and Example:
cd -
4. Switch back to previous directory

Syntax and Example:
cd ../

Thank you so much friends to read this post, Keep Supporting.

Give your valuable time