1 00:00:00,000 --> 00:00:02,340 ‫-: Hi, within this lecture 2 00:00:02,340 --> 00:00:06,720 ‫we are gonna start seeing the basic Linux commands. 3 00:00:06,720 --> 00:00:10,050 ‫So what we are gonna do, we're gonna run the terminal. 4 00:00:10,050 --> 00:00:13,230 ‫So within this terminal you might see your username 5 00:00:13,230 --> 00:00:15,990 ‫as a different thing rather than Kali. 6 00:00:15,990 --> 00:00:18,450 ‫So if you have installed the ISO, 7 00:00:18,450 --> 00:00:21,690 ‫you'll have already determined your own username. 8 00:00:21,690 --> 00:00:24,750 ‫If you're using the OVA created for this course, 9 00:00:24,750 --> 00:00:28,800 ‫you may see this as a root and it doesn't matter. 10 00:00:28,800 --> 00:00:31,110 ‫We're gonna see what difference can it make 11 00:00:31,110 --> 00:00:32,760 ‫in the upcoming lectures. 12 00:00:32,760 --> 00:00:35,940 ‫But right now you just have to worry about 13 00:00:35,940 --> 00:00:36,990 ‫what's coming next. 14 00:00:36,990 --> 00:00:41,310 ‫So you don't have to worry about this at all, okay? 15 00:00:41,310 --> 00:00:43,290 ‫So you have a different username, 16 00:00:43,290 --> 00:00:44,970 ‫maybe you have the same username. 17 00:00:44,970 --> 00:00:46,560 ‫It really doesn't matter. 18 00:00:46,560 --> 00:00:48,930 ‫What matters is that we need to understand 19 00:00:48,930 --> 00:00:51,090 ‫what this terminal does. 20 00:00:51,090 --> 00:00:54,720 ‫So within this terminal, we write commands 21 00:00:54,720 --> 00:00:58,800 ‫and it actually gets executed by Kali Linux. 22 00:00:58,800 --> 00:01:00,570 ‫And in fact, we have seen this 23 00:01:00,570 --> 00:01:03,720 ‫when I showed you how to change the keyboard, right? 24 00:01:03,720 --> 00:01:05,460 ‫So what we are gonna do next 25 00:01:05,460 --> 00:01:09,930 ‫is to open this file manager, okay? 26 00:01:09,930 --> 00:01:12,120 ‫So if you open the folder, you can see 27 00:01:12,120 --> 00:01:16,110 ‫that whether your username is Kali or something else 28 00:01:16,110 --> 00:01:19,350 ‫you can see all these documents, download, 29 00:01:19,350 --> 00:01:22,800 ‫desktop file system and everything. 30 00:01:22,800 --> 00:01:27,090 ‫So what we're gonna do next is to learn how to navigate 31 00:01:27,090 --> 00:01:29,220 ‫inside of the terminal. 32 00:01:29,220 --> 00:01:32,160 ‫So we can execute commands 33 00:01:32,160 --> 00:01:36,450 ‫in any of these folders and it can make a difference. 34 00:01:36,450 --> 00:01:37,800 ‫So first of all, 35 00:01:37,800 --> 00:01:41,220 ‫we need to understand how to navigate, okay? 36 00:01:41,220 --> 00:01:43,440 ‫Right now we are in some folder, 37 00:01:43,440 --> 00:01:47,790 ‫we are in some kind of place inside of our file manager, 38 00:01:47,790 --> 00:01:50,040 ‫and we don't know where. 39 00:01:50,040 --> 00:01:53,970 ‫So in order to find out, we need to write some commands. 40 00:01:53,970 --> 00:01:57,600 ‫We need to execute some commands and check the output. 41 00:01:57,600 --> 00:02:01,140 ‫And then we can navigate through as if we are clicking, 42 00:02:01,140 --> 00:02:03,300 ‫double clicking on any of this, 43 00:02:03,300 --> 00:02:07,200 ‫going into the documents, creating a folder here. 44 00:02:07,200 --> 00:02:08,400 ‫Okay, let me do that. 45 00:02:08,400 --> 00:02:12,000 ‫Let me create a folder, but not from here, 46 00:02:12,000 --> 00:02:14,880 ‫maybe from the terminal, okay? 47 00:02:14,880 --> 00:02:16,560 ‫Let me show you what I mean. 48 00:02:16,560 --> 00:02:20,790 ‫I'm inside of Kali right now and I'm writing PWD. 49 00:02:20,790 --> 00:02:25,790 ‫It stands for Print Working Directory, okay? 50 00:02:25,800 --> 00:02:29,310 ‫So it will show you where we are currently. 51 00:02:29,310 --> 00:02:34,310 ‫As it turns out that I'm inside of home Kali folder, okay? 52 00:02:35,100 --> 00:02:37,680 ‫So it's the same folder that I have seen 53 00:02:37,680 --> 00:02:41,280 ‫when I opened the file manager before. 54 00:02:41,280 --> 00:02:44,460 ‫Because I'm inside of the Kali user, okay? 55 00:02:44,460 --> 00:02:47,820 ‫And again, if you're inside of some other user 56 00:02:47,820 --> 00:02:49,920 ‫then you should be seeing that. 57 00:02:49,920 --> 00:02:52,380 ‫And it really doesn't matter where you are right now 58 00:02:52,380 --> 00:02:56,760 ‫because we are going to see how to navigate in a minute. 59 00:02:56,760 --> 00:02:59,460 ‫So over here, what I'm going to to do, 60 00:02:59,460 --> 00:03:03,240 ‫I'm going to try and see what kind of folders 61 00:03:03,240 --> 00:03:08,240 ‫and files are there inside of the home and Kali, okay? 62 00:03:08,310 --> 00:03:11,160 ‫So it turns out I'm inside of the Kali folder. 63 00:03:11,160 --> 00:03:14,310 ‫So maybe I want to go into some of the folders 64 00:03:14,310 --> 00:03:17,190 ‫like documents and downloads and stuff. 65 00:03:17,190 --> 00:03:20,310 ‫By the way, if you come over here to file preferences 66 00:03:20,310 --> 00:03:24,180 ‫you can change the fonts, you can change the appearances. 67 00:03:24,180 --> 00:03:26,760 ‫So my size is 20 right now. 68 00:03:26,760 --> 00:03:28,800 ‫If you want, you can make it bigger, 69 00:03:28,800 --> 00:03:30,303 ‫you can make it smaller. 70 00:03:31,529 --> 00:03:32,869 ‫I'm using it this big 71 00:03:32,869 --> 00:03:34,440 ‫so that you can see it in a better way, okay? 72 00:03:34,440 --> 00:03:36,723 ‫But you can change it in a way that you want. 73 00:03:37,731 --> 00:03:40,860 ‫Anyway, so we have printed out the working directory. 74 00:03:40,860 --> 00:03:43,980 ‫And again, I wonder what's inside of it. 75 00:03:43,980 --> 00:03:48,240 ‫So I can run this unless it's kind of listing. 76 00:03:48,240 --> 00:03:50,940 ‫It lists the folders and files 77 00:03:50,940 --> 00:03:53,250 ‫available in the current folder. 78 00:03:53,250 --> 00:03:55,830 ‫If I open that folder, you will actually see 79 00:03:55,830 --> 00:03:58,969 ‫that desktop, documents, downloads and stuff 80 00:03:58,969 --> 00:04:03,969 ‫are actually inside of this Kali folder, right? 81 00:04:04,140 --> 00:04:07,470 ‫So I see exactly those folders. 82 00:04:07,470 --> 00:04:11,430 ‫If I want to, I can double click into any of those. 83 00:04:11,430 --> 00:04:14,880 ‫I can change my folder, for example, into the documents, 84 00:04:14,880 --> 00:04:18,240 ‫and I can see what's inside of that as well. 85 00:04:18,240 --> 00:04:20,820 ‫The command to do that is CD. 86 00:04:20,820 --> 00:04:24,600 ‫And CD stands for change directory. 87 00:04:24,600 --> 00:04:26,640 ‫And you have to make sure that you are writing 88 00:04:26,640 --> 00:04:29,310 ‫exactly as it is, upper case D 89 00:04:29,310 --> 00:04:31,620 ‫and something like that, okay? 90 00:04:31,620 --> 00:04:36,210 ‫So you should exactly write like this, CD space documents 91 00:04:36,210 --> 00:04:38,340 ‫or CD space downloads. 92 00:04:38,340 --> 00:04:40,290 ‫And once I execute that 93 00:04:40,290 --> 00:04:43,650 ‫I'm inside of the documents right now, okay? 94 00:04:43,650 --> 00:04:46,770 ‫Now I have double clicked, 95 00:04:46,770 --> 00:04:49,470 ‫so it's exactly like double clicking. 96 00:04:49,470 --> 00:04:52,350 ‫Now if I run LS over here, as you can see, 97 00:04:52,350 --> 00:04:53,760 ‫I got nothing back 98 00:04:53,760 --> 00:04:56,967 ‫because there isn't anything inside of the documents. 99 00:04:56,967 --> 00:04:59,610 ‫If there was, I would've seen that. 100 00:04:59,610 --> 00:05:01,620 ‫Great, now I'm gonna right click 101 00:05:01,620 --> 00:05:05,010 ‫and create a folder over here, for example. 102 00:05:05,010 --> 00:05:07,740 ‫I'm gonna create a test folder, okay? 103 00:05:07,740 --> 00:05:11,430 ‫And once I do that, I can go back to the terminal 104 00:05:11,430 --> 00:05:16,170 ‫and run LS one more time to see test folder actually exists. 105 00:05:16,170 --> 00:05:18,990 ‫Right now I'm getting tests because it's there. 106 00:05:18,990 --> 00:05:23,250 ‫Of course, I could have created this test from here as well. 107 00:05:23,250 --> 00:05:24,900 ‫We're gonna see it, don't worry. 108 00:05:24,900 --> 00:05:26,910 ‫But the idea over here is that 109 00:05:26,910 --> 00:05:29,217 ‫you can see the available files and folders 110 00:05:29,217 --> 00:05:33,120 ‫and you can interact with them using the terminal. 111 00:05:33,120 --> 00:05:37,601 ‫And obviously we don't have to go over the file manager 112 00:05:37,601 --> 00:05:40,830 ‫and the right click and create folder 113 00:05:40,830 --> 00:05:44,850 ‫anytime we need to create a folder or create a document. 114 00:05:44,850 --> 00:05:48,600 ‫We can do that with the terminal as well. 115 00:05:48,600 --> 00:05:51,270 ‫Right now, I'm inside of the documents 116 00:05:51,270 --> 00:05:55,560 ‫and assume that I want to create a test two folder, okay? 117 00:05:55,560 --> 00:05:57,930 ‫If I'm sure that I'm inside of the documents, 118 00:05:57,930 --> 00:06:00,090 ‫inside of my terminal I mean, 119 00:06:00,090 --> 00:06:02,910 ‫I can run this command, mkdir. 120 00:06:02,910 --> 00:06:07,470 ‫So mkdir, it stands for Making Directory, okay? 121 00:06:07,470 --> 00:06:10,890 ‫So for example, if I write this, mkdir test2 122 00:06:10,890 --> 00:06:12,450 ‫then if I write LS, 123 00:06:12,450 --> 00:06:16,685 ‫I can see that test and test2 is actually over there. 124 00:06:16,685 --> 00:06:20,670 ‫As you can see, it's actually created the test2 folder 125 00:06:20,670 --> 00:06:22,290 ‫inside of the documents. 126 00:06:22,290 --> 00:06:26,220 ‫And the idea of the navigation between the folders 127 00:06:26,220 --> 00:06:28,050 ‫derives from this. 128 00:06:28,050 --> 00:06:31,080 ‫Because once I, by the way, if you write clear, 129 00:06:31,080 --> 00:06:33,000 ‫it just clears the screen. 130 00:06:33,000 --> 00:06:35,701 ‫Once I created that folder 131 00:06:35,701 --> 00:06:39,540 ‫it actually has been created inside of the documents, okay? 132 00:06:39,540 --> 00:06:43,080 ‫Right now, if I write LS, I can see it. 133 00:06:43,080 --> 00:06:47,030 ‫If I want to, I can go into that folder as well. 134 00:06:47,030 --> 00:06:49,530 ‫Writing CD test2. 135 00:06:49,530 --> 00:06:53,460 ‫Right now I'm inside of the documents and test2 folder. 136 00:06:53,460 --> 00:06:56,700 ‫If I create any file, or if I create any folder, 137 00:06:56,700 --> 00:06:58,920 ‫I can't just do it in the test2. 138 00:06:58,920 --> 00:07:01,500 ‫And if I write this cd .. 139 00:07:01,500 --> 00:07:03,990 ‫it'll just take me to the previous folder 140 00:07:03,990 --> 00:07:06,596 ‫which is the documents in this case, right? 141 00:07:06,596 --> 00:07:11,596 ‫It's exactly clicking on the back button over here. 142 00:07:11,730 --> 00:07:16,560 ‫So of course you can use this CD command, and LS command 143 00:07:16,560 --> 00:07:20,160 ‫in order to navigate throughout the terminal. 144 00:07:20,160 --> 00:07:24,060 ‫So for example, you can go back to the user, 145 00:07:24,060 --> 00:07:27,990 ‫the home Kali folder, you can go to the downloads, 146 00:07:27,990 --> 00:07:31,170 ‫you can go to the desktop, you can create folders, 147 00:07:31,170 --> 00:07:34,860 ‫you can create files if you want. 148 00:07:34,860 --> 00:07:37,620 ‫So depending on where you are 149 00:07:37,620 --> 00:07:41,250 ‫it may produce some different behavior, right? 150 00:07:41,250 --> 00:07:44,100 ‫For example, if you create a folder inside of desktop 151 00:07:44,100 --> 00:07:47,160 ‫it'll appear in the desktop, not in the documents. 152 00:07:47,160 --> 00:07:49,890 ‫So that is why it's important 153 00:07:49,890 --> 00:07:53,160 ‫for us to learn about this navigation first. 154 00:07:53,160 --> 00:07:54,987 ‫So right now I'm inside of the documents 155 00:07:54,987 --> 00:07:58,200 ‫and if I write LS, I can see the folders, right? 156 00:07:58,200 --> 00:08:01,140 ‫So there is test and test2. 157 00:08:01,140 --> 00:08:04,260 ‫So assume that I wanna create a file. 158 00:08:04,260 --> 00:08:07,470 ‫So the command for that is touch. 159 00:08:07,470 --> 00:08:11,010 ‫So if you write anything over here after the touch, 160 00:08:11,010 --> 00:08:12,270 ‫it will be created. 161 00:08:12,270 --> 00:08:17,270 ‫It can be a Python file, Java file, txt file, jpeg file, 162 00:08:17,700 --> 00:08:20,460 ‫whatever you may wanna think of, okay? 163 00:08:20,460 --> 00:08:25,080 ‫It doesn't create a folder, it creates a file for you. 164 00:08:25,080 --> 00:08:30,080 ‫And obviously we can use this to create some maybe, I dunno, 165 00:08:31,260 --> 00:08:34,770 ‫text files to have some notes inside of it. 166 00:08:34,770 --> 00:08:38,400 ‫For example notes.txt, okay? 167 00:08:38,400 --> 00:08:40,350 ‫And when I execute this, 168 00:08:40,350 --> 00:08:43,890 ‫this notes.txt is actually created 169 00:08:43,890 --> 00:08:47,070 ‫inside of the document's folder, as you can see. 170 00:08:47,070 --> 00:08:49,260 ‫Right now, I can double click on it, 171 00:08:49,260 --> 00:08:53,640 ‫I can write inside, I can write anything inside of it. 172 00:08:53,640 --> 00:08:54,596 ‫And by the way, 173 00:08:54,596 --> 00:08:58,230 ‫before double clicking, maybe you may want to right click it 174 00:08:58,230 --> 00:09:01,200 ‫and just select the thing that you may want 175 00:09:01,200 --> 00:09:02,700 ‫to open this bit. 176 00:09:02,700 --> 00:09:06,420 ‫But don't worry about the editors like Mousepad, Wim, 177 00:09:06,420 --> 00:09:10,380 ‫I'm just going to show you a better way to do that, okay? 178 00:09:10,380 --> 00:09:12,690 ‫So don't worry about opening 179 00:09:12,690 --> 00:09:15,750 ‫and writing something inside of it. 180 00:09:15,750 --> 00:09:19,770 ‫We're gonna use something called Nano in order to do that 181 00:09:19,770 --> 00:09:21,510 ‫for the upcoming lectures. 182 00:09:21,510 --> 00:09:25,140 ‫Right now, we are just seeing how to navigate through. 183 00:09:25,140 --> 00:09:27,960 ‫So assume that we have created this, 184 00:09:27,960 --> 00:09:31,650 ‫created this notes.txt. 185 00:09:31,650 --> 00:09:36,650 ‫Maybe I want to move that, maybe I want to delete that. 186 00:09:36,840 --> 00:09:39,390 ‫Maybe I want to see the difference 187 00:09:39,390 --> 00:09:41,640 ‫between those and the folders. 188 00:09:41,640 --> 00:09:43,770 ‫So if I write LS, as you can see, 189 00:09:43,770 --> 00:09:46,860 ‫notes.txt is written in white. 190 00:09:46,860 --> 00:09:49,020 ‫And this test are written in blue. 191 00:09:49,020 --> 00:09:53,430 ‫Of course, it depends on the team, it depends on the colors 192 00:09:53,430 --> 00:09:56,490 ‫but they are shown in different colors 193 00:09:56,490 --> 00:09:58,140 ‫so that we can understand 194 00:09:58,140 --> 00:10:01,851 ‫whether this is a file and folder. 195 00:10:01,851 --> 00:10:05,220 ‫And if I go to cd.., if I write LS, 196 00:10:05,220 --> 00:10:08,940 ‫as you can see everything is shown in blue right now 197 00:10:08,940 --> 00:10:12,540 ‫which makes me think that everything is folder right now. 198 00:10:12,540 --> 00:10:17,170 ‫So I can go back and I can see that if I write LS, 199 00:10:17,170 --> 00:10:20,100 ‫the Kali is again a folder. 200 00:10:20,100 --> 00:10:22,710 ‫There isn't any file inside over here. 201 00:10:22,710 --> 00:10:23,880 ‫So this home folder 202 00:10:23,880 --> 00:10:26,550 ‫is actually the folder for different users. 203 00:10:26,550 --> 00:10:31,140 ‫Of course, we can have multiple users when we use the Linux. 204 00:10:31,140 --> 00:10:33,540 ‫And right now I'm seeing Kali, 205 00:10:33,540 --> 00:10:36,570 ‫maybe you're seeing something else but it doesn't matter. 206 00:10:36,570 --> 00:10:39,390 ‫Right now, you know how to navigate between them, right? 207 00:10:39,390 --> 00:10:41,730 ‫You can write cd Kali, or cd, 208 00:10:41,730 --> 00:10:43,920 ‫whatever you see it over here. 209 00:10:43,920 --> 00:10:47,910 ‫And then you can come to that folder. 210 00:10:47,910 --> 00:10:52,910 ‫And you can run LS to see what's the content of it. 211 00:10:53,130 --> 00:10:57,210 ‫So make sure you run PWD before you do anything else 212 00:10:57,210 --> 00:10:59,820 ‫so that you can understand where you are. 213 00:10:59,820 --> 00:11:03,330 ‫And if you want, you can write make their touch, 214 00:11:03,330 --> 00:11:05,020 ‫LS, cd ... 215 00:11:05,020 --> 00:11:08,700 ‫And so all of this stuff will enable you 216 00:11:08,700 --> 00:11:11,280 ‫to navigate through the terminal. 217 00:11:11,280 --> 00:11:13,590 ‫But again, maybe I want to delete them, 218 00:11:13,590 --> 00:11:15,480 ‫maybe I want to move them. 219 00:11:15,480 --> 00:11:17,100 ‫And in order to do that 220 00:11:17,100 --> 00:11:19,920 ‫we need to learn all those commands as well. 221 00:11:19,920 --> 00:11:22,920 ‫That's exactly what we are gonna do within the next lecture.