How to create new folders on a Linux
The next step we want to create a few folders. As we never talked about it before lets stop for a second and talk about the way you access and create new folders. In our example we create a few folders in one shot using the shortcut way:
sudo mkdir -p www/example/public
Video Transcript
00:00Welcome back. So the next step is figuring out what folder and what area do we want to actually host our server?
00:08Now by default you would find your server you would find the folder area of your server if you type on CD slash
00:15Var it's going to be in the www
00:18Folder and this is really the the hub of everything. So if I type your LS to see the folder
00:23You'll see that this is where the default location of where my server is meant to be now in reality though
00:29Many times you're going to give your developer access to the server and when you're putting files in this folder
00:35You can't really give access to specific users specific folders that easily
00:40While on the other hand if you put the site itself in a folder of the user itself
00:45You could then share that user or give that user access and the user could gain access to everything that's inside of that
00:51Access level for that user and that's one of the reasons why I like putting my folders not in the default location
00:58But I like putting them actually inside of the users folder. So to do that
01:02I'm going to go back into my user folder by typing CD and a squiggly line. I don't even know how it's called
01:08You'll find it right next to the one sign just type on shift and left to the one sign you have there that commonly
01:14swishy type of like
01:16Area just find it on your keyboard and go into that folder and that will always take you back to your home screen your home
01:22Folder. All right
01:24So the next step now that I know that I decided that I want to create my folder inside of my user
01:28I'll see that currently my user folder is empty
01:31But what I really want is to create some sort of a folder that will be our HTML sites of sorts inside of this
01:38Users folder to do that
01:40What I'm going to do is I'm going to create a new folder and to do that
01:44I want to use the sudo command because I don't really want this folder to be of this user
01:49I want this folder to actually later on actually be of apache of our
01:54Httpd that we've created. So I'm going to use the command mkdir
01:58And mkdir is basically going to enable me to create a new folder
02:02Now in our case because I want to create a few sub folders
02:06What I want to do is I'm going to create a quick
02:10shortcut of creating a few folders that are one inside of each other to do that
02:14I'm going to type minus p and minus p is going to enable me to create a few folders in one hit
02:20So in this case, I want to create the folder
02:23Www and inside of there I'm going to create a folder called example and I'm going to create a folder called public
02:29The reason is is because I might have private files inside of the example folder
02:34But only the public folder is the folder that I want to be owned and available for the web itself
02:41Once I click on enter it's going to ask me for my password and I'm going to type that in and now when I do a search
02:47I'm going to see that I have the ww directory and it's going to have all the sub directories that we've created
02:53All right, so that was the process of creating a folder. It was easy enough
02:57Now that we have this directory again speaking about permissions and speaking about rights
03:02We want to follow through with two more steps
03:05One step is we want to make sure that the public folder of our server is
03:10Available to Apache because right now this folder might belong to the root
03:14It probably belongs to the root
03:16But we what we want to do is we want to force it to be owned not by this user not by the root
03:21But to actually be owned by Apache itself
