1 00:00:00,570 --> 00:00:01,589 Hello everyone. 2 00:00:01,589 --> 00:00:06,170 In this demo, I'm going to show you how to remove directories and files. 3 00:00:06,180 --> 00:00:11,220 If I would like to remove an empty directory, I'm going to run the command rmdir. 4 00:00:11,250 --> 00:00:12,840 Then the name of the directory. 5 00:00:12,840 --> 00:00:13,770 For example. 6 00:00:13,770 --> 00:00:15,900 Directory four hit enter. 7 00:00:15,930 --> 00:00:22,110 Now I'm going to double check if I do have the directory I don't have directory for here anymore. 8 00:00:22,680 --> 00:00:29,850 Assume that I have a directory and subdirectories and I would like to remove the sub directory. 9 00:00:30,120 --> 00:00:40,110 So what I'm going to do, I'm going to use the same command r MDR and I have here D one and inside d 10 00:00:40,110 --> 00:00:41,670 one there is D two. 11 00:00:42,060 --> 00:00:44,190 I'm going to remove D two. 12 00:00:44,220 --> 00:00:46,260 Then I hit enter. 13 00:00:46,380 --> 00:00:49,020 Let's double check D one. 14 00:00:49,170 --> 00:00:53,340 As we can see here, we don't have d two anymore. 15 00:00:54,120 --> 00:01:03,190 If I would like to delete parents so the directory and even the sub directory for example, here we 16 00:01:03,190 --> 00:01:07,960 have Linux and inside Linux we have another directory or sub directory. 17 00:01:07,990 --> 00:01:09,100 It's called RedHat. 18 00:01:09,100 --> 00:01:12,940 So I'm going to type out MDR. 19 00:01:13,150 --> 00:01:19,600 Then I have to type the option dash P, this is appearance. 20 00:01:19,600 --> 00:01:23,350 So he's going to delete the directory and the sub directory. 21 00:01:23,350 --> 00:01:30,730 So Linux then Red Hat I hit enter lSl. 22 00:01:31,030 --> 00:01:33,640 As we can see here, we don't have. 23 00:01:34,600 --> 00:01:36,430 The Linux directory anymore. 24 00:01:38,260 --> 00:01:44,980 If I would like to get more information about this command, I can go to the man page and we can get 25 00:01:44,980 --> 00:01:50,440 more details and information about the Dir command. 26 00:01:50,650 --> 00:01:54,310 There is another command also we can use. 27 00:01:54,730 --> 00:02:02,740 And let's go to the man page of the r m so r m removes files and directories. 28 00:02:02,950 --> 00:02:11,520 So for the previous command, the rmdir that one is just to remove directories, but for the rm it remove 29 00:02:11,530 --> 00:02:14,530 so the removes files and directories. 30 00:02:15,320 --> 00:02:17,890 So okay, let's go back here. 31 00:02:17,890 --> 00:02:25,930 And what I would like to do right now, I would like to remove, for example, the text file here. 32 00:02:26,890 --> 00:02:29,050 And f1 dot txt. 33 00:02:29,920 --> 00:02:33,580 Let's double check so we don't have the text file anymore. 34 00:02:33,610 --> 00:02:35,060 F1 dot txt. 35 00:02:35,730 --> 00:02:42,680 If I would like to remove a directory, for example, assume that I would like to remove directory three 36 00:02:42,690 --> 00:02:43,730 so rme. 37 00:02:44,160 --> 00:02:50,790 However, for this command we have to use the recursive. 38 00:02:50,820 --> 00:02:57,660 The dash r in case if there is any subdirectories inside the directory. 39 00:02:57,660 --> 00:02:58,290 So. 40 00:02:58,290 --> 00:03:03,650 And then I'm going to type dir three hit enter L. 41 00:03:03,840 --> 00:03:08,610 As we can see here, we don't have directory three here anymore. 42 00:03:10,800 --> 00:03:12,510 Now if I would like. 43 00:03:13,510 --> 00:03:15,770 To run the option dash. 44 00:03:15,820 --> 00:03:28,030 I for example here the dash I in order to promote or to ask us the system will ask the user before every 45 00:03:28,030 --> 00:03:28,630 removal. 46 00:03:28,630 --> 00:03:31,930 If you are sure you want to delete this text file. 47 00:03:31,930 --> 00:03:35,590 For example, if I would like to delete if for. 48 00:03:36,670 --> 00:03:37,930 I'm going to type a force. 49 00:03:37,930 --> 00:03:41,590 So the system will promote a question so you can see it here. 50 00:03:41,920 --> 00:03:43,510 Now I have to answer. 51 00:03:43,510 --> 00:03:44,290 Yes. 52 00:03:44,320 --> 00:03:45,250 Hit enter. 53 00:03:45,890 --> 00:03:50,260 As you can see here, so we don't have F4 anymore. 54 00:03:50,950 --> 00:03:54,190 And there is also another option. 55 00:03:54,580 --> 00:03:55,400 It's dash. 56 00:03:55,450 --> 00:04:04,330 If it's full dash f like force, if I would like to force the system to remove the file, for example, 57 00:04:04,330 --> 00:04:08,860 I'm going to force the system to delete this directory. 58 00:04:08,980 --> 00:04:11,230 I'm going to hit enter L. 59 00:04:11,290 --> 00:04:14,710 As we can see here, we do have D one anymore. 60 00:04:15,690 --> 00:04:18,450 If I would like to remove all the text files. 61 00:04:18,450 --> 00:04:27,330 So I'm going to r m dash r then I'm going to type star dot txt. 62 00:04:27,660 --> 00:04:35,790 So in this command I'm going to tell the system that I would like to remove all the text file so anything 63 00:04:35,790 --> 00:04:36,690 doesn't matter. 64 00:04:36,690 --> 00:04:42,870 We start with what dot txt as long as the file ends with the txt. 65 00:04:43,020 --> 00:04:46,350 So the system will remove that text file. 66 00:04:46,890 --> 00:04:49,140 Hit enter lSl. 67 00:04:49,410 --> 00:04:54,230 As we can see here, we don't have any text file anymore. 68 00:04:54,240 --> 00:04:57,210 If I would like to remove the directories. 69 00:04:57,210 --> 00:04:59,100 Also I'm going to do the same thing. 70 00:04:59,130 --> 00:05:00,870 R m r. 71 00:05:02,250 --> 00:05:04,950 So our m r dash r. 72 00:05:04,950 --> 00:05:06,540 This is for the recursive. 73 00:05:06,570 --> 00:05:10,470 Then I'm going to type d i r then star. 74 00:05:11,180 --> 00:05:15,140 So as we can notice here, we have one and two. 75 00:05:15,170 --> 00:05:19,270 So and they are they have the same name. 76 00:05:19,340 --> 00:05:24,290 They like they share the dir and the dir at the beginning. 77 00:05:24,290 --> 00:05:29,900 So I would like to I'm going to tell the system to delete all the directories. 78 00:05:29,900 --> 00:05:36,200 It doesn't matter what's the ending of this directory to enter right now? 79 00:05:36,230 --> 00:05:40,970 lSl As we can see here, we don't have the directories here anymore. 80 00:05:41,240 --> 00:05:43,070 We would like to get more information. 81 00:05:43,070 --> 00:05:49,190 As I mentioned, I can go to the main page of the RM, so you can see here we can find more information 82 00:05:49,190 --> 00:05:55,070 about this command and also we can find the options that we can use with this command. 83 00:05:56,640 --> 00:05:58,440 Thus conclude our session. 84 00:05:58,530 --> 00:06:01,110 Thank you and see you in the next lesson.