Home Web Hosting Linux Tutorials Linux Changing to a Different Directory Tutorial Guide

Linux Changing to a Different Directory Tutorial Guide

create a directory in linux, make directory
create a directory in linux, make directory

When it comes to changing to a different directory inside Linux this can simply be done by using the simple # cd and # ls commands.

To check which folder you are in type in # ls

# ls
home dir
home dir

As you can see on the screen we see our home dir, if you are not home use the # cd / command to return to your home location if you need to.

Then we will simply go inside our test folder and make 2 folders within our test folder.

To do this we will type in # cd testfolder which will move us out from our current working position and inside the testfolder

moving to a different directory in linux
moving to a different directory in linux

to check that we are inside this testfolder which should be empty, we can test by using command # ls again, which should show empty feedback.

checking empty dir in linux
checking empty dir in linux

When there is nothing shown on our screen we know that this folder is now empty

Then we will create our 2 new folders inside this testfolder which will be located at root/testfolder/”our new folders”

So we will create a test1 and test2 inside “testfolder” to do this we will type in

# mkdir test1
making new folder inside our new location linux
making new folder inside our new location Linux

then simply hit enter and type in again “# mkdir test2”

# mkdir test2

Now we should have made 2 subfolders in our main folder named “testfolder”, this is “test1” and “test2”

Let’s check using the GUI file/folder layout on our server

made 2 new folders in linux
made 2 new folders in linux

we can also view check this by using the commands

example of viewing folder in linux
example of viewing folder in linux
  1. Type in # cd / to go to the main home directory
  2. Then use # cd testfolder to move inside the testfolder
  3. Then to read files or folder inside the test folder type # dir
  4. You will now see 2 folder came back which we made “test1” and “test2”

We hope you guys have learned something from this tutorial

Please leave a comment if you have any questions, thanks and see you again soon.

More Linux Tutorials on directories with Linux UNIX commands

LEAVE A REPLY

Please enter your comment!
Please enter your name here