1
00:00:06,639 --> 00:00:10,800
In this video we'll discuss
some essentials for working with directories.

2
00:00:11,359 --> 00:00:17,269
So CD is what you use to change directory
and MKDIR allows you to create a new directory.

3
00:00:18,949 --> 00:00:24,003
If you use MKDIR P, you
can create an entire new directory path,

4
00:00:24,003 --> 00:00:29,056
as in MKDIR P my new
files without a P it would fill

5
00:00:29,056 --> 00:00:34,109
and with a P you create
the entire path and then rmdir.

6
00:00:35,009 --> 00:00:40,899
Well, in fact, RMDIR is a useless command. It
removes the directory, but it only works if the

7
00:00:40,899 --> 00:00:46,789
directory is empty. Better use RM RF because that
also works if there is files in the directory.

8
00:00:47,429 --> 00:00:48,170
Let's check
it out.

9
00:00:49,670 --> 00:00:54,119
I'm starting by using CD without
any arguments. Did you notice what happens?

10
00:00:55,020 --> 00:00:59,439
It brings me to my home directory and
that is what CD without arguments is always doing.

11
00:01:00,079 --> 00:01:05,049
I want to be in my home directory
because otherwise I don't have any write permissions.

12
00:01:06,450 --> 00:01:10,745
Now I'm going to use
an MKDIR data and. Oh boy,

13
00:01:10,745 --> 00:01:15,040
what is happening here? Well,
we have a permission denied.

14
00:01:15,620 --> 00:01:21,810
That's because the only location where as an ordinary
user I can create files is in my home directory.

15
00:01:22,920 --> 00:01:28,000
If I really wanted to create this directory data,
I need to put sudo in front of it.

16
00:01:29,219 --> 00:01:33,859
So then I need to enter my
sudo password and now it is created. Let's

17
00:01:33,859 --> 00:01:38,500
check it out using LS LD data
and there we can see that it exists.

18
00:01:40,500 --> 00:01:45,549
Now in fact, I don't want to
have this directory data, so I'm using RMDIR

19
00:01:45,549 --> 00:01:50,599
and that is even working because I
did not create any files in there.

20
00:01:51,909 --> 00:01:58,079
Now how about MKDIR files? Data that doesn't
work for the simple reason that I'm trying

21
00:01:58,079 --> 00:02:04,250
to create directory data in the directory
files, but the directory files does not exist.

22
00:02:04,890 --> 00:02:11,259
Simple solution, add P to it and
that will create the entire directory path.

23
00:02:12,020 --> 00:02:15,639
That's about all that you need to
know for now about working with directories.
