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

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)

tla@tla:~/tastethelinux$ cd ../
tla@tla:~$ pwd

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 ../../”

tla@tla:~/tastethelinux$ cd ../../

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?

[wp_quiz id=”1185″]

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.

One Reply to “cd command in Linux with examples”

Give your valuable time