1 00:00:00,300 --> 00:00:03,870 ‫-: Hi, within this lecture we are gonna focus on moving, 2 00:00:03,870 --> 00:00:06,540 ‫deleting the files and folders 3 00:00:06,540 --> 00:00:08,970 ‫in order to master the navigation. 4 00:00:08,970 --> 00:00:11,700 ‫So, right now I'm gonna go into the documents. 5 00:00:11,700 --> 00:00:15,600 ‫Okay, and if I write ls, I can see that notes.txt 6 00:00:15,600 --> 00:00:18,840 ‫and test and test2 folders are over here. 7 00:00:18,840 --> 00:00:21,930 ‫Obviously, can create your own files and folders 8 00:00:21,930 --> 00:00:23,880 ‫in order to test this stuff. 9 00:00:23,880 --> 00:00:28,140 ‫So we are obviously inside of /home/kali/documents, right? 10 00:00:28,140 --> 00:00:30,720 ‫And I know that there are other folders 11 00:00:30,720 --> 00:00:33,180 ‫inside of /home/kali. 12 00:00:33,180 --> 00:00:37,170 ‫Right, because I can see them like downloads, music, 13 00:00:37,170 --> 00:00:39,570 ‫pictures public and stuff. 14 00:00:39,570 --> 00:00:43,320 ‫So assume that I wanna put the notes.txt 15 00:00:43,320 --> 00:00:46,470 ‫into test folder, okay. 16 00:00:46,470 --> 00:00:51,270 ‫So maybe I want to move it, maybe I want to copy it. 17 00:00:51,270 --> 00:00:53,520 ‫I can do both by cutting 18 00:00:53,520 --> 00:00:55,770 ‫or copying the thing over here, right. 19 00:00:55,770 --> 00:00:59,790 ‫Because it's just GUI, it's very basic to do so. 20 00:00:59,790 --> 00:01:00,990 ‫And you know how to do that 21 00:01:00,990 --> 00:01:04,200 ‫from Windows and other operating systems. 22 00:01:04,200 --> 00:01:07,410 ‫But idea over here is to learn how to do that 23 00:01:07,410 --> 00:01:08,880 ‫within the terminal. 24 00:01:08,880 --> 00:01:13,170 ‫And it appears that the commands to do that are very easy. 25 00:01:13,170 --> 00:01:16,350 ‫Like there are two commands, cp and mv. 26 00:01:16,350 --> 00:01:21,000 ‫cp stands for copying, mv stands for moving. 27 00:01:21,000 --> 00:01:23,760 ‫Okay, so moving is like cutting the file 28 00:01:23,760 --> 00:01:27,420 ‫and pasting into something else like some other folder. 29 00:01:27,420 --> 00:01:29,940 ‫And copying is just copying the file 30 00:01:29,940 --> 00:01:32,700 ‫and pasting in some other folder. 31 00:01:32,700 --> 00:01:34,500 ‫So we're gonna see both. 32 00:01:34,500 --> 00:01:38,520 ‫Let's assume that I wanna copy the notes.txt 33 00:01:38,520 --> 00:01:41,100 ‫into the test folder, okay. 34 00:01:41,100 --> 00:01:44,637 ‫So I can do that, copy notes.txt 35 00:01:44,637 --> 00:01:48,450 ‫but I can't do that because I'm inside of the documents. 36 00:01:48,450 --> 00:01:52,410 ‫If I run ls, I can see notes.txt. 37 00:01:52,410 --> 00:01:55,830 ‫Let's assume that I want to do that 38 00:01:55,830 --> 00:01:57,870 ‫from another folder. 39 00:01:57,870 --> 00:02:00,450 ‫Let's assume that I'm inside of the downloads 40 00:02:00,450 --> 00:02:03,150 ‫but I still want to copy the notes.txt 41 00:02:03,150 --> 00:02:05,010 ‫inside of the documents. 42 00:02:05,010 --> 00:02:07,650 ‫So maybe I can explicitly state 43 00:02:07,650 --> 00:02:12,650 ‫that it's /home/kali/documents/notes.txt, okay. 44 00:02:13,140 --> 00:02:15,240 ‫But since I'm inside of the documents, 45 00:02:15,240 --> 00:02:19,230 ‫I can just do that copy, notes.txt. 46 00:02:19,230 --> 00:02:23,430 ‫All I gotta do is just to state where I want to copy this. 47 00:02:23,430 --> 00:02:26,640 ‫So I want to copy this inside of the test folder. 48 00:02:26,640 --> 00:02:29,670 ‫And also I want to state the file name 49 00:02:29,670 --> 00:02:34,200 ‫that I will be copying, like test/notes.txt, okay. 50 00:02:34,200 --> 00:02:37,770 ‫I can just state another file name here as well 51 00:02:37,770 --> 00:02:41,790 ‫but I'm just gonna keep it as notes.txt. 52 00:02:41,790 --> 00:02:46,790 ‫So you can write copy notes.txt at the right side 53 00:02:46,830 --> 00:02:50,730 ‫if you want to rename this while copying, okay. 54 00:02:50,730 --> 00:02:54,270 ‫So if I run that, it'll just execute this command 55 00:02:54,270 --> 00:02:57,990 ‫and it will put the notes.txt, copy the notes.txt, 56 00:02:57,990 --> 00:03:00,720 ‫and paste it under the test folder. 57 00:03:00,720 --> 00:03:04,680 ‫So let's do that and let's cd into, 58 00:03:04,680 --> 00:03:05,610 ‫let me run ls. 59 00:03:05,610 --> 00:03:08,760 ‫As you can see, notes.txt is still here. 60 00:03:08,760 --> 00:03:13,320 ‫Let me go into the test and if I write ls, here you go, 61 00:03:13,320 --> 00:03:18,320 ‫notes.txt just appeared over here because I've copied it. 62 00:03:19,140 --> 00:03:21,210 ‫Okay, now we have seen copy. 63 00:03:21,210 --> 00:03:24,420 ‫So you write the thing that you may wanna copy 64 00:03:24,420 --> 00:03:28,740 ‫and you write the thing that you may want to move that into. 65 00:03:28,740 --> 00:03:31,470 ‫Okay, so this is how copy works. 66 00:03:31,470 --> 00:03:33,750 ‫So let's see, we are inside of test 67 00:03:33,750 --> 00:03:35,880 ‫and we still have notes.txt. 68 00:03:35,880 --> 00:03:38,610 ‫Let's assume that I want to delete it. 69 00:03:38,610 --> 00:03:40,350 ‫So in order to delete it, 70 00:03:40,350 --> 00:03:45,350 ‫I can use rm command which stands for removing, okay. 71 00:03:45,570 --> 00:03:48,180 ‫If you execute this command, here you go. 72 00:03:48,180 --> 00:03:52,620 ‫You deleted notes.txt, which is cool. 73 00:03:52,620 --> 00:03:56,100 ‫Right, all you gotta do is just write this command. 74 00:03:56,100 --> 00:04:00,420 ‫Obviously, right now if I write ls, you won't see anything. 75 00:04:00,420 --> 00:04:03,840 ‫And obviously, if I go back to the documents 76 00:04:03,840 --> 00:04:05,490 ‫I can still see 77 00:04:05,490 --> 00:04:09,330 ‫the test that notes.txt over there 78 00:04:09,330 --> 00:04:13,140 ‫because I have only deleted the copy of it. 79 00:04:13,140 --> 00:04:16,860 ‫And by the way, you don't even have to know everything 80 00:04:16,860 --> 00:04:18,510 ‫about this commands. 81 00:04:18,510 --> 00:04:22,860 ‫Right, because it's just simple right now. 82 00:04:22,860 --> 00:04:26,010 ‫But it may get complicated after a while. 83 00:04:26,010 --> 00:04:30,090 ‫And all you gotta do is to understand the logic behind this 84 00:04:30,090 --> 00:04:34,290 ‫and maybe you may want to familiarize yourself 85 00:04:34,290 --> 00:04:37,530 ‫in order to read documentation. 86 00:04:37,530 --> 00:04:39,960 ‫So let me do an example. 87 00:04:39,960 --> 00:04:44,070 ‫So I'm going to create a folder over here 88 00:04:44,070 --> 00:04:46,740 ‫with rmtest, okay. 89 00:04:46,740 --> 00:04:50,970 ‫So I, it's just a folder inside of the test folder, okay. 90 00:04:50,970 --> 00:04:52,080 ‫It's just a folder. 91 00:04:52,080 --> 00:04:56,790 ‫I can see that when I write ls. I can see the rmtest. 92 00:04:56,790 --> 00:05:01,590 ‫Let me try to delete that by removing it, okay. 93 00:05:01,590 --> 00:05:03,840 ‫So as you can see, it gives me an error. 94 00:05:03,840 --> 00:05:08,370 ‫It says that cannot remove rmtest, it's a directory. 95 00:05:08,370 --> 00:05:12,570 ‫So it seems that the rmtest is a folder 96 00:05:12,570 --> 00:05:17,040 ‫and we cannot actually delete the folders with rm command. 97 00:05:17,040 --> 00:05:19,410 ‫So let me run this, 98 00:05:19,410 --> 00:05:22,620 ‫let me run rm help 99 00:05:22,620 --> 00:05:26,250 ‫to see the documentation about rm. 100 00:05:26,250 --> 00:05:31,250 ‫So rm is actually a binary and like a executable 101 00:05:31,350 --> 00:05:35,040 ‫and they all have this documentation. 102 00:05:35,040 --> 00:05:36,960 ‫Most of the time you can reach them 103 00:05:36,960 --> 00:05:41,960 ‫by adding this --help at the end of the command, okay. 104 00:05:42,150 --> 00:05:46,140 ‫So that it can actually show you the documentation, 105 00:05:46,140 --> 00:05:49,980 ‫the help module of the rm binary. 106 00:05:49,980 --> 00:05:52,230 ‫Okay, if you do that, 107 00:05:52,230 --> 00:05:55,410 ‫I'm not even sure if it's going to show us, 108 00:05:55,410 --> 00:05:58,620 ‫but if it's not --help, 109 00:05:58,620 --> 00:06:01,350 ‫it's something like -h. 110 00:06:01,350 --> 00:06:04,680 ‫And as you can see, it shows us the usage, 111 00:06:04,680 --> 00:06:09,680 ‫it shows us the different parameters that we can give to rm. 112 00:06:09,990 --> 00:06:12,540 ‫And if I take a look over here, 113 00:06:12,540 --> 00:06:15,870 ‫there is some parameter called -r, 114 00:06:15,870 --> 00:06:19,080 ‫and it says that remove directories. 115 00:06:19,080 --> 00:06:22,710 ‫So yeah, maybe I've forgotten how to remove the directories 116 00:06:22,710 --> 00:06:24,150 ‫or delete the directories. 117 00:06:24,150 --> 00:06:29,070 ‫I can just see that by writing rm --help, okay. 118 00:06:29,070 --> 00:06:32,790 ‫For example, there is another parameter over here, -f. 119 00:06:32,790 --> 00:06:37,790 ‫It's just deletes the thing with -f with force, okay. 120 00:06:37,980 --> 00:06:41,520 ‫So no matter what, it just deletes the thing. 121 00:06:41,520 --> 00:06:44,850 ‫So as you can see, rmtest is a folder. 122 00:06:44,850 --> 00:06:49,350 ‫And let me write this rm -r and rmtest. 123 00:06:49,350 --> 00:06:50,880 ‫And here you go. 124 00:06:50,880 --> 00:06:53,610 ‫Now it got deleted. 125 00:06:53,610 --> 00:06:57,150 ‫So let me try to create some, 126 00:06:57,150 --> 00:06:59,070 ‫let me try to write ls. 127 00:06:59,070 --> 00:07:01,230 ‫And here you go, we don't have anything else. 128 00:07:01,230 --> 00:07:04,350 ‫Let me just create it one more time 129 00:07:04,350 --> 00:07:07,740 ‫and I'm gonna show you rm -rf. 130 00:07:07,740 --> 00:07:11,010 ‫And again, this is by force, 131 00:07:11,010 --> 00:07:13,830 ‫it means that just delete the thing 132 00:07:13,830 --> 00:07:16,290 ‫without thinking anything else, okay. 133 00:07:16,290 --> 00:07:20,250 ‫So even if you get like a warning message or error message, 134 00:07:20,250 --> 00:07:21,750 ‫just delete the thing. 135 00:07:21,750 --> 00:07:24,720 ‫And here you go, it just deletes the thing. 136 00:07:24,720 --> 00:07:27,330 ‫Okay, so just bear that in mind. 137 00:07:27,330 --> 00:07:30,363 ‫rm -r, rm -rf. 138 00:07:31,350 --> 00:07:33,810 ‫So let me go back to documents. 139 00:07:33,810 --> 00:07:36,540 ‫As you can see, notes.txt is over here 140 00:07:36,540 --> 00:07:40,380 ‫because we have just deleted the copy of it. 141 00:07:40,380 --> 00:07:42,240 ‫So let me try and move. 142 00:07:42,240 --> 00:07:45,750 ‫Move takes in the arguments exactly like in the copy. 143 00:07:45,750 --> 00:07:48,660 ‫So I wanna move that to test2 this time. 144 00:07:48,660 --> 00:07:50,730 ‫And here you go. It worked. 145 00:07:50,730 --> 00:07:54,240 ‫So I want to move, notes.txt to test2. 146 00:07:54,240 --> 00:07:57,570 ‫And as you can see, when I write ls I cannot see it. 147 00:07:57,570 --> 00:08:01,500 ‫But if I go to test2, I can see it, okay. 148 00:08:01,500 --> 00:08:03,900 ‫That's the difference between moving and copying. 149 00:08:03,900 --> 00:08:06,450 ‫So moving is like cutting and pasting. 150 00:08:06,450 --> 00:08:08,910 ‫Copying is like copying and pasting. 151 00:08:08,910 --> 00:08:10,980 ‫Okay, just bear that in mind. 152 00:08:10,980 --> 00:08:14,040 ‫And again, we are doing all of this stuff 153 00:08:14,040 --> 00:08:17,280 ‫in order to get familiarized with the terminal. 154 00:08:17,280 --> 00:08:20,670 ‫Great, now we started to learn something. 155 00:08:20,670 --> 00:08:24,273 ‫I believe we can stop here and continue within the next one.