1 00:00:00,270 --> 00:00:05,100 Hello everybody and welcome back to the Linux Part 2 tutorial. 2 00:00:05,310 --> 00:00:07,570 Well Linux commands part tutorial. 3 00:00:07,890 --> 00:00:11,860 Now as you may see right here I have two terminals open one. 4 00:00:11,880 --> 00:00:13,850 I will just write the comments as we do them. 5 00:00:13,890 --> 00:00:17,690 And in the other one I will put them in a text file. 6 00:00:17,700 --> 00:00:22,620 So just I will open this comment that texting you have to open this file. 7 00:00:22,620 --> 00:00:25,950 This is just for me so I know which commands I covered in which I didn't. 8 00:00:26,820 --> 00:00:29,760 And the other one we will just test the commands in this one. 9 00:00:30,240 --> 00:00:38,220 So before we begin I just want to mention the command that we did in the previous video which is the 10 00:00:38,220 --> 00:00:39,030 city command. 11 00:00:39,810 --> 00:00:47,790 Now you know that you now know that it stands for change directory and basically just change the directory 12 00:00:48,120 --> 00:00:50,980 to another directory from this terminal. 13 00:00:52,020 --> 00:00:55,000 Now for example let's say we want to go to document directory. 14 00:00:55,020 --> 00:00:57,630 We could just have here see these documents. 15 00:01:00,600 --> 00:01:07,170 But the question now is if for example if you wanted to go one directory back how do you do that. 16 00:01:07,170 --> 00:01:14,130 Well there comes the simple command which also starts with C D but instead of typing here a directory 17 00:01:14,340 --> 00:01:19,610 you can just use Type 2 dots which will basically lead you one directory back. 18 00:01:19,650 --> 00:01:25,530 So if I present right here let me back the previous directory to the root directory. 19 00:01:25,710 --> 00:01:29,380 As you can see right here print working directory we are again in the root. 20 00:01:29,430 --> 00:01:35,100 And if we type Ellis to list the current folders and files in this directory we will once again see 21 00:01:35,100 --> 00:01:36,210 the documents right here 22 00:01:39,160 --> 00:01:45,240 basically just wanted to mention that that you can change directory with a document with the city command 23 00:01:45,280 --> 00:01:48,380 and you can also go on directory back. 24 00:01:48,550 --> 00:01:54,520 So for example if you wanted if you had let's say a directory 25 00:01:57,090 --> 00:02:02,830 in the documents directory I just created it with M K Kadir command we also cover that in the previous 26 00:02:02,830 --> 00:02:05,140 video stands for make directory. 27 00:02:05,140 --> 00:02:10,390 You can see that now in documents directory we have a number one another directory which I basically 28 00:02:10,390 --> 00:02:18,280 called just directory and also let's go to that directory and you can see that our current path right 29 00:02:18,280 --> 00:02:25,230 now is slash documents slash directory now in order to go back to directories. 30 00:02:25,230 --> 00:02:27,290 You can just type here two times. 31 00:02:27,540 --> 00:02:30,200 And then two dots and then see these then two dots. 32 00:02:30,270 --> 00:02:34,830 And now we are going to be back once again in the root directory. 33 00:02:34,920 --> 00:02:40,940 So now that we got that out of the way I will just type it right here so I know I cover that command 34 00:02:41,670 --> 00:02:45,730 and we will clear the screen for the next command. 35 00:02:45,750 --> 00:02:49,180 Now this one is a simple command. 36 00:02:49,180 --> 00:02:56,050 For example if you wanted to check out on which account are you currently which most likely will be 37 00:02:56,050 --> 00:02:57,100 on the root account. 38 00:02:57,100 --> 00:03:04,240 You can just type here command which basically does what it says it's who am I. 39 00:03:04,240 --> 00:03:09,090 The command basically just asks Who is the current user of this terminal. 40 00:03:09,220 --> 00:03:12,910 And right now as we can see it is rude you can just read from here. 41 00:03:12,970 --> 00:03:19,500 If you if you don't need to even write this command you can just read it from this first word right 42 00:03:19,500 --> 00:03:26,450 here which will most likely be rude unless you have another account which will cover in some next videos 43 00:03:26,460 --> 00:03:32,940 how to make another account which could be useful because we do not want to run all our programs as 44 00:03:32,940 --> 00:03:33,800 a route user. 45 00:03:33,900 --> 00:03:35,630 It can be dangerous. 46 00:03:35,700 --> 00:03:41,970 So in another radio we will cover how to make another user which you could use for some potentially 47 00:03:41,970 --> 00:03:43,070 dangerous programs. 48 00:03:44,380 --> 00:03:47,640 So now I will just write it right here. 49 00:03:47,650 --> 00:03:54,400 This is not really that useful comment but in case you forget or in case a user is named something differently 50 00:03:54,400 --> 00:03:56,790 than rude you can just check here with who am I. 51 00:03:56,800 --> 00:04:03,890 Comment now there is a comment that I used in the previous videos but never really explained what it 52 00:04:03,890 --> 00:04:04,350 does. 53 00:04:04,920 --> 00:04:06,960 And right now we will cover it. 54 00:04:07,380 --> 00:04:12,060 It's a it's an important comment especially if you're running some of the programs or downloading the 55 00:04:12,060 --> 00:04:14,450 programs which are not executable. 56 00:04:14,790 --> 00:04:19,690 And you for example want to make them and executable so you can run them in your terminal. 57 00:04:19,860 --> 00:04:26,280 Now in order to demonstrate this command I would just go and make folder code programs because we can 58 00:04:26,280 --> 00:04:31,710 see it is right here and I will change my directory into that program right now. 59 00:04:32,550 --> 00:04:38,460 I will basically just create a simple simple python program 60 00:04:41,920 --> 00:04:49,360 that simple python program we will call well we can just go program that it doesn't really matter. 61 00:04:49,520 --> 00:04:54,930 Right here all this code a simple addition program. 62 00:04:55,350 --> 00:04:56,940 Just give me one second. 63 00:04:56,940 --> 00:04:58,400 It doesn't matter at the moment. 64 00:04:58,410 --> 00:04:59,160 What am I doing. 65 00:04:59,160 --> 00:05:04,620 But we will be also covering by the late Ron for example enter first number 66 00:05:07,440 --> 00:05:16,710 will be for example and the second number and C will equal eight times B. 67 00:05:16,710 --> 00:05:21,630 Now this is simple to understand we basically ask for an input for two numbers. 68 00:05:21,630 --> 00:05:30,580 No just making an addition and storing it in C and then we will we can basically just print that number 69 00:05:30,840 --> 00:05:32,960 at C number the result. 70 00:05:33,070 --> 00:05:43,170 So we just type here result equals 2 and then plus string from C. 71 00:05:43,330 --> 00:05:45,640 I hope this works it should probably work. 72 00:05:45,640 --> 00:05:52,570 So we have here a program called program but by way it is a python program but you might notice that 73 00:05:52,660 --> 00:05:59,050 if we tried to run that program and you'd do that by typing here dot and then slash and then the name 74 00:05:59,050 --> 00:06:03,100 of the program you'll notice that it won't work. 75 00:06:03,100 --> 00:06:05,420 It would say permission denied. 76 00:06:05,420 --> 00:06:07,180 Now why is the permission denied. 77 00:06:07,180 --> 00:06:08,660 Well if we use a command. 78 00:06:08,710 --> 00:06:14,560 Let me just clear clear a screen right here we have a command that we covered previously do which is 79 00:06:14,630 --> 00:06:21,320 Alice minus L. A we can see all the files in the current directory. 80 00:06:21,340 --> 00:06:23,830 Also the hidden files and also our program. 81 00:06:23,840 --> 00:06:25,850 But by now. 82 00:06:25,870 --> 00:06:27,210 What interests us here. 83 00:06:27,250 --> 00:06:28,370 Is this part right here. 84 00:06:28,870 --> 00:06:33,230 Basically these are just the modes that are enabled for this file. 85 00:06:33,700 --> 00:06:39,830 R stands for Reed now that stands for right and X stands for execute. 86 00:06:39,850 --> 00:06:45,790 Now you might notice that in our program the PI we don't have an x which stands for execute. 87 00:06:45,910 --> 00:06:51,530 Therefore we cannot really execute that program in order to make that program executable. 88 00:06:51,640 --> 00:06:58,150 We want to type here c h mode plus X. And then the name of the program. 89 00:06:58,180 --> 00:07:04,480 Now if I click here enter and type your Ellis L.A. again you can see now that the program changed its 90 00:07:04,480 --> 00:07:06,070 color and not only the color. 91 00:07:06,070 --> 00:07:10,830 It also added the x which stands for as I said executable. 92 00:07:10,960 --> 00:07:13,920 You can see the difference from here and from here. 93 00:07:14,680 --> 00:07:17,770 And that's how you can check if the program is executable or not. 94 00:07:17,980 --> 00:07:19,650 So now let's clear the screen now. 95 00:07:19,810 --> 00:07:25,420 If you wanted to you can run the program it Alaska center first number let's say three and through second 96 00:07:25,420 --> 00:07:28,900 number four and it will say result equals 212. 97 00:07:29,680 --> 00:07:30,870 Now it isn't. 98 00:07:30,880 --> 00:07:37,330 This comment is important and you should learn it be used to make any program that is not executable 99 00:07:37,360 --> 00:07:43,600 and executable so negative that that comment all the way I would just remove this book. 100 00:07:43,930 --> 00:07:45,580 Well actually I believe it right here. 101 00:07:45,580 --> 00:07:50,910 Maybe we'll use it for another comment such as cat. 102 00:07:51,070 --> 00:07:53,150 Let's cover that comment right now. 103 00:07:53,180 --> 00:08:02,710 Cat basically the comment cat stands for what not stands for it basically just prints out the contents 104 00:08:02,770 --> 00:08:06,760 of the file on into our own terminal as an output. 105 00:08:06,760 --> 00:08:12,280 So if you type your cat and then the name of our file for example if you just type a to just print out 106 00:08:12,280 --> 00:08:17,820 the code that we just type as you can see right here it can be used. 107 00:08:17,830 --> 00:08:22,090 So you don't really open the file in order to read this. 108 00:08:22,210 --> 00:08:27,790 You can just print it out in the terminal with cat command and it will just print out all the contents 109 00:08:27,790 --> 00:08:30,760 from the file. 110 00:08:31,050 --> 00:08:33,840 Now that is not the use of this command. 111 00:08:33,840 --> 00:08:41,340 Basically the menus of this command would probably be in some of the bigger files where you just want 112 00:08:41,340 --> 00:08:47,850 to find a certain thing in that in order to demonstrate what I mean. 113 00:08:47,940 --> 00:08:54,400 We will combine the cat command with the another command called grep. 114 00:08:54,850 --> 00:09:00,540 Now basically what grep does is if you want to list for example a huge file with bunch of words and 115 00:09:00,630 --> 00:09:09,630 from that huge file you want to know you want to put aside all the words that contain for example password 116 00:09:10,040 --> 00:09:13,510 in the let me just demonstrate. 117 00:09:13,520 --> 00:09:15,320 Maybe it's easier if they demonstrate it. 118 00:09:15,350 --> 00:09:22,360 Now what you create in progress file another file with you which will be called of the extreme and here 119 00:09:22,460 --> 00:09:33,060 will just type here a bunch of words and then one two three password one two three then a bunch of words. 120 00:09:33,080 --> 00:09:45,760 And for example a b c password X for example and then a bunch of other random stuff. 121 00:09:45,770 --> 00:09:54,200 Now if we save this file serial city are out to save enter to save under that name and see TRL X to 122 00:09:54,200 --> 00:09:54,910 close. 123 00:09:55,130 --> 00:09:58,860 We can see that right here we have that word that the c file. 124 00:09:59,120 --> 00:10:05,420 Now in order to see the contents of that file as I said we can type just cat warns that the extreme 125 00:10:05,540 --> 00:10:08,250 and we will see all of those words. 126 00:10:08,370 --> 00:10:14,040 Now here we can basically with our own eyes find the all the words that contain password in them. 127 00:10:14,940 --> 00:10:22,670 But let's say for example you wanted to let's say for example that this file was much bigger with millions 128 00:10:22,670 --> 00:10:27,770 and millions of words you can possibly just go through all of those words and just fine by yourself. 129 00:10:27,770 --> 00:10:31,580 All of those comments and not comments all of those words that contained passwords in them. 130 00:10:32,720 --> 00:10:39,440 So what you want to do is combine the kept command with the grep command. 131 00:10:39,650 --> 00:10:40,700 How do we do that. 132 00:10:40,700 --> 00:10:46,720 Well basically we just thought of the same command cat words that the AKC and then we basically like 133 00:10:47,790 --> 00:10:49,850 the grep comment how do we pipe. 134 00:10:49,940 --> 00:10:57,860 Well basically this straight line to stop it right here and then you type here grep and then then the 135 00:10:58,460 --> 00:11:01,910 word that you want to be contained in the other words. 136 00:11:01,930 --> 00:11:04,850 So for example password in our case. 137 00:11:04,850 --> 00:11:10,880 Now what this will do it will list all the words that contain the word password and then as we see it 138 00:11:10,880 --> 00:11:19,810 on listed two words which is ABC password X and one two three password one two three so it is often 139 00:11:20,050 --> 00:11:26,260 a very important mix of two comments which you will be using a lot at least I am using it a lot in my 140 00:11:26,260 --> 00:11:26,650 case. 141 00:11:28,090 --> 00:11:37,510 So let's continue with another comment which can be right now echo basically eco you can just use it 142 00:11:37,540 --> 00:11:43,180 to add for example a word into another file without opening it. 143 00:11:43,310 --> 00:11:51,450 For example I want to add John as a word into file words the text. 144 00:11:51,940 --> 00:11:59,220 So you just do you just type echo John and then this arrow that points to right and then supports that. 145 00:11:59,650 --> 00:12:01,170 And you can see the command worked. 146 00:12:01,180 --> 00:12:05,590 And right now if we get the that that Steve it will only be John. 147 00:12:05,590 --> 00:12:09,690 Now you might be asking where did the other words go. 148 00:12:09,700 --> 00:12:18,170 Well if you use the echo command it will basically have they say that it will mean they will rewrite 149 00:12:19,070 --> 00:12:20,540 the entire text file. 150 00:12:20,570 --> 00:12:28,090 So from those bunch of words it both basically deleted all of them and just put John in there. 151 00:12:28,100 --> 00:12:38,000 Now if we use another word let's say echo Jake into the sea and we can once again words like this in 152 00:12:38,000 --> 00:12:45,470 order to see if we can see that John is no longer there it's only Jake so that we just type hear the 153 00:12:45,530 --> 00:12:48,440 echo comment. 154 00:12:49,640 --> 00:12:55,310 One more thing you want to know which I probably should've mentioned at the beginning and it is really 155 00:12:55,310 --> 00:13:09,820 important is this command right here APD updates and one second APD upgrades. 156 00:13:09,950 --> 00:13:15,830 Now this basically these referring to your lineage scanning and suppositories and it will basically 157 00:13:15,830 --> 00:13:17,620 just check with the updates from there. 158 00:13:17,780 --> 00:13:22,490 And in case there are some updates it will download them and you can install the updates with the app 159 00:13:22,610 --> 00:13:24,340 upgrade command. 160 00:13:24,380 --> 00:13:30,050 Now you want to run this command as you finish the installation of clinics but we will be doing that 161 00:13:30,050 --> 00:13:38,930 command in a next video because the apps upgrade command will take after the installation I believe 162 00:13:38,930 --> 00:13:44,960 about an hour in order to finish because it will download just a bunch of other files and upgrade them. 163 00:13:45,020 --> 00:13:48,470 And I don't even know what not to just take a lot of time. 164 00:13:48,470 --> 00:13:49,630 That's what I know. 165 00:13:49,640 --> 00:13:53,440 So we'll be doing that command at the end. 166 00:13:53,500 --> 00:14:00,380 So right now if you for example want to check out the history of all of the commands you typed previously 167 00:14:00,380 --> 00:14:05,630 in this current session of the session of terminal you can just do that with the simple command which 168 00:14:05,630 --> 00:14:16,280 says history and just print us right here all the commands they ran before. 169 00:14:16,290 --> 00:14:21,510 So as you can see right here these are the commands that we ran before. 170 00:14:21,510 --> 00:14:24,210 It's not that useful but you might need it sometime. 171 00:14:25,410 --> 00:14:29,760 I don't use that much next command. 172 00:14:29,760 --> 00:14:30,690 We want to do. 173 00:14:31,620 --> 00:14:34,760 Let's say for example we want to copy the. 174 00:14:35,010 --> 00:14:43,440 You want to copy the program that by file into another directory so just create directory another directory 175 00:14:44,160 --> 00:14:45,930 in this program directory. 176 00:14:45,930 --> 00:14:49,510 So we'll call it test directory for example. 177 00:14:49,510 --> 00:14:55,110 And now you can see that we have the test directory which is blue and the green program that pipe file 178 00:14:55,320 --> 00:14:57,500 which is an executable. 179 00:14:57,520 --> 00:15:02,870 Now you want to for example copy this file into the Test directory. 180 00:15:02,910 --> 00:15:05,170 We do that with the simple CPE command. 181 00:15:05,460 --> 00:15:10,530 Well C.P. basically stands for copy and you just type here the file that you want to copy which in our 182 00:15:10,530 --> 00:15:17,310 case is program the pie and then you type in type here the directory you want to copy it in and in our 183 00:15:17,310 --> 00:15:18,390 case it is best. 184 00:15:18,780 --> 00:15:25,140 So just press your enter and basically as you can see right now if we change directory to test we will 185 00:15:25,140 --> 00:15:27,740 have also a program API there. 186 00:15:27,990 --> 00:15:32,710 And they're basically identical so if we get this program back by internal directory then we go one 187 00:15:32,700 --> 00:15:38,510 directory back can get here a program provider basically identical because we copy them. 188 00:15:39,390 --> 00:15:43,530 So let me just put here S.P. comment. 189 00:15:44,130 --> 00:15:45,640 We finish that comment. 190 00:15:46,770 --> 00:15:53,500 But let's say for example you didn't want to copy the file that you just deleted from the text directory 191 00:15:53,530 --> 00:15:56,590 you wanted to move it. 192 00:15:57,360 --> 00:15:58,450 It is no longer here. 193 00:15:58,470 --> 00:16:06,080 You want to move it from program programs directory into text directory. 194 00:16:06,420 --> 00:16:14,700 You do that with the command which tends to move program the pie and then the directory where we want 195 00:16:14,700 --> 00:16:15,150 to move it. 196 00:16:15,150 --> 00:16:21,390 So test in uppercase you can see right now if we type here else in order to list all the files we can 197 00:16:21,390 --> 00:16:27,740 see that the program the pie is no longer here it is now moved to the test directory. 198 00:16:28,140 --> 00:16:34,840 So we type your Alice in the test directory and now it is only here. 199 00:16:34,980 --> 00:16:42,000 Now this command can be used for two things in order to move files from one directory to another directory 200 00:16:42,240 --> 00:16:44,740 and in order to rename files. 201 00:16:44,820 --> 00:16:51,000 So for example if I type here Move program the pie and then I don't specify I directory where I want 202 00:16:51,000 --> 00:16:53,900 to move it but they specify another name for the file. 203 00:16:53,910 --> 00:17:02,820 So let's say another name the pie which is not a directory is a file it will rename the program that 204 00:17:02,820 --> 00:17:09,510 pie into another name the pie as we can see right here there is no problem that by now the program is 205 00:17:09,510 --> 00:17:11,360 called another name the pie. 206 00:17:11,580 --> 00:17:19,180 And if we catch it right here we can see that it is the same program that we type before so it is also 207 00:17:19,180 --> 00:17:27,570 important to know that it can be used for two things which is we name any more. 208 00:17:27,910 --> 00:17:29,140 Just so you know. 209 00:17:29,140 --> 00:17:39,330 And now we can basically right now we can cover some of the more basic comments such as men. 210 00:17:39,400 --> 00:17:46,070 Now this comment basically is used for opening a manual for any other comments. 211 00:17:46,090 --> 00:17:48,380 If we type here men. 212 00:17:48,540 --> 00:17:57,700 Men cat it will open us a file which will basically give you all the options available for the cat comment 213 00:18:00,370 --> 00:18:04,580 as you can see right here it can be used for any other comments of this type here. 214 00:18:04,590 --> 00:18:12,080 MAN See it will open up a manual for the CPD command where you can see what else you can do with the 215 00:18:12,080 --> 00:18:14,470 CB comment as it says right here. 216 00:18:14,470 --> 00:18:17,590 Copy files and directories. 217 00:18:17,590 --> 00:18:21,040 Now for example you can type here man. 218 00:18:21,040 --> 00:18:21,980 History. 219 00:18:21,990 --> 00:18:22,960 No I don't know if you can. 220 00:18:23,020 --> 00:18:29,660 Yes it has the manual on the history based sex manual for all the other commands these manuals though 221 00:18:29,770 --> 00:18:32,390 are already pre installed on linux. 222 00:18:32,410 --> 00:18:38,160 You will have them with the installation of it so you can just check out if you forget what some command 223 00:18:38,160 --> 00:18:39,400 does or something like that. 224 00:18:39,400 --> 00:18:45,790 You can just type your land and then grep and it will basically open you up with manual and you can 225 00:18:45,790 --> 00:18:48,400 just read right here and use the command. 226 00:18:48,400 --> 00:18:55,240 So now the figure that the way you will be using manual a lot in the program slate from which you do 227 00:18:55,240 --> 00:19:01,780 not know how they work so you will be opening up a lot of manuals in order to find out the command that 228 00:19:01,780 --> 00:19:06,850 you need to use in order to run that program. 229 00:19:06,870 --> 00:19:17,280 Also if we for example wanted to let's say locate some of the files you for example forgot where we 230 00:19:17,280 --> 00:19:20,600 sent the file and we want to locate it. 231 00:19:20,670 --> 00:19:27,350 We can do that with simple command code locate so let me just try here with another name. 232 00:19:27,370 --> 00:19:29,140 Apply for example. 233 00:19:29,170 --> 00:19:29,370 Yeah. 234 00:19:29,390 --> 00:19:31,080 I don't think it will work like this. 235 00:19:31,080 --> 00:19:37,150 I'm pretty sure why but for example you want to locate every file in the system which has word in it. 236 00:19:37,760 --> 00:19:44,240 You can just type your locate and you will see that we have it will print up a bunch of these files 237 00:19:44,570 --> 00:19:48,200 and they all have in some of the parts that they have worked in. 238 00:19:48,440 --> 00:19:50,530 So let's see right here. 239 00:19:50,750 --> 00:19:54,610 As you can see this file has than it right here. 240 00:19:54,650 --> 00:19:58,580 So Kelly minus S word and then something else. 241 00:19:58,580 --> 00:20:00,840 All of these files will have a word in it. 242 00:20:00,920 --> 00:20:04,900 So let's say you want to locate everything that has more list. 243 00:20:04,910 --> 00:20:10,070 It will also print out all the files that have what list net as you can see where this list were less 244 00:20:10,100 --> 00:20:14,000 than were list dot list and so on and so on. 245 00:20:14,600 --> 00:20:16,490 So we call that command as well. 246 00:20:16,490 --> 00:20:20,270 Now this is about it for this story. 247 00:20:20,300 --> 00:20:28,220 And in the next one we will cover some of the comments which are not new are more towards the system 248 00:20:28,340 --> 00:20:32,780 that you're using so for example not that checks some of the system settings you will be running the 249 00:20:32,780 --> 00:20:37,530 commands that will show you in the next video such as for example shut down. 250 00:20:37,740 --> 00:20:43,320 Yes to name and restart reboot and so on and so on. 251 00:20:43,480 --> 00:20:46,960 I have config and bunch of those network commands. 252 00:20:47,360 --> 00:20:50,430 So you should learn this. 253 00:20:50,630 --> 00:20:55,910 You should remember like these are some of the more important commands that you will be using all the 254 00:20:55,910 --> 00:20:56,980 time. 255 00:20:57,530 --> 00:21:00,700 And that's about it for this tutorial. 256 00:21:00,740 --> 00:21:04,340 I hope I see you in the next one by.