Linux Changing to a...
 
Notifications
Clear all

Linux Changing to a Different Directory Tutorial

1 Posts
1 Users
0 Reactions
28 Views
(@allseobasics)
Posts: 40
Member Admin
Topic starter
 

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

I wanted to show this command of Linux, it's a very simple command and works great when it comes to directories and changing between directories.

This is the Linux command to check which folder you are in, simply type # ls

# ls

home dir

As you can see on the screen I can see my home directory, if you are not home use the # cd / command to return to your home location if you need to.

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

To do this you will simply type in # cd testfolder which will move you out from our current working position and inside the test folder.

moving to a different directory in linux

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

checking empty dir in linux

When there is nothing shown on my screen, I know that this folder is now empty.

Then I will create my 2 new folders inside this testfolder which will be located at root/testfolder/"my new folders"

At this time we will create a test1 and test2 inside "testfolder" To do this you guys will type in the code shown below;

# mkdir test1

making new folder inside our new location linux

Then simply hit enter and type in again "# mkdir test2"

# mkdir test2

Now you guys should have made 2 subfolders in your main folder named "testfolder", this is "test1" and "test2"

Finally, let's check this by using the GUI file/folder feature, which should be located in your server.

made 2 new folders in linux

Alternatively, you guys can also view-check this by using the commands. Check below;

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 folders came back which we made "test1" and "test2"

Altogether, I hope you guys have learned something from this tutorial.

Hey guys, this is a very simple Linux tutorial, please leave a comment if you have any questions, thanks.

 
Posted : 20/04/2025 5:00 pm
Share: