Full Stack for Front End Engineers Creating a web directory
This course has been updated! We now recommend you take the Full Stack for Front-End Engineers, v3 course.
Transcript from the "Creating a web directory" Lesson
>> Jem: So next we're gonna make a www directory, this is where we're gonna put all of our files that we want to serve out. So we're gonna make it in the /var is generally where you put things like this.
>> Jem: So sudo mkdir -p /var/www. And I'll go ahead and do that as well.
[00:00:22] So sudo mkdir.
>> Speaker 2: We already got one.
>> Jem: You do?
>> Speaker 2: I think NGINX-
>> Jem: It might have it by default, that's a good point, let me-
>> Speaker 2: Yeah that's usually where the it works comes from.
>> Jem: It already has one in there, awesome, so we don't have to do that.
[00:00:36] But just in case you're on a server that doesn't have a www built in, you can make it. But let's just go ahead and cd into that directory, so cd /var/www. And if we ls, there's an HTML folder in there already, but we won't need that for now.
>> Speaker 2: So, question, what's the point of the p after make directory? Won't that make a directory? You know what I'm saying? You said that the p was for it'll create a directory if it's not there already.
>> Jem: Yeah.
>> Speaker 2: But what's the point of having-
>> Jem: Yeah, so let's test that out.
[00:01:12] So if I wanna mkdir, actually I'll just do a temp one here. So mkdir tmp, forgot to change sudo. Bang, bang. So now I've got temp directory. So if I mkdir again,
>> Jem: It's gonna throw an error. But if I do sudo-p, it won't error out.
>> Speaker 2: mkdir.
>> Jem: Thanks, I am not perfect, by far, and it won't throw an error. That's where you use a -p command.
>> Speaker 2: The other thing you can do is if you create a directory chain and the intermediate directories don't exist, the -p will create them as well.
>> Jem: Yes.
>> Speaker 2: Cool, okay.
>> Jem: Good, good point, yeah.
>> Speaker 2: Cool.
>> Jem: So generally if I'm making a directory, I always use -p because it's-
>> Speaker 2: Just to be safe.
>> Jem: Just to be safe, yeah.
>> Speaker 2: Yeah, that's why I just didn't, yeah, okay, cool.
>> Jem: Yeah, great, thank you, that's an excellent tip.