1 00:00:07,230 --> 00:00:10,050 - So we've talked about working with Linux 2 00:00:10,050 --> 00:00:12,390 and logging in and user accounts a little bit. 3 00:00:12,390 --> 00:00:15,240 It's time to get to know some commands. 4 00:00:15,240 --> 00:00:19,410 So I have put together some of the most useful commands. 5 00:00:19,410 --> 00:00:21,150 These are the commands that you are going to work 6 00:00:21,150 --> 00:00:23,490 with a lot, especially if you're a starter. 7 00:00:23,490 --> 00:00:27,000 It starts with whoami, giving you your login name 8 00:00:27,000 --> 00:00:28,860 in case you're confused about it. 9 00:00:28,860 --> 00:00:33,450 ls for listing files, ip a, which was print your IP address. 10 00:00:33,450 --> 00:00:36,127 Cat, very convenient to show text cells, 11 00:00:36,127 --> 00:00:39,870 passwd for for setting your password, 12 00:00:39,870 --> 00:00:44,190 touch, for verifying writability of specific directories 13 00:00:44,190 --> 00:00:47,520 and pwd for printing working directories. 14 00:00:47,520 --> 00:00:48,970 Let me show you all of these. 15 00:00:51,810 --> 00:00:52,643 All right. 16 00:00:52,643 --> 00:00:53,553 Let me start with whoami. 17 00:00:54,720 --> 00:00:58,350 I am user student and do we have any options? 18 00:00:58,350 --> 00:00:59,460 I would always advise 19 00:00:59,460 --> 00:01:02,040 if you're starting to learn new commands, type command 20 00:01:02,040 --> 00:01:03,810 minus minus help just for the sake 21 00:01:03,810 --> 00:01:06,450 of it to find out if there are any options 22 00:01:06,450 --> 00:01:09,570 and it appears for whoami, there are not 23 00:01:09,570 --> 00:01:13,110 then let's have a look at ls, ls is listing files 24 00:01:13,110 --> 00:01:16,470 listing files in the current directory. 25 00:01:16,470 --> 00:01:18,690 And it has a lot of options. 26 00:01:18,690 --> 00:01:22,320 ls minus minus help is showing you all of these options. 27 00:01:22,320 --> 00:01:23,620 It has so many options 28 00:01:23,620 --> 00:01:26,430 that it doesn't even fit in one alphabet. 29 00:01:26,430 --> 00:01:29,100 Do you see that we have a lowercase x 30 00:01:29,100 --> 00:01:32,670 and we have an uppercase x, for instance. 31 00:01:32,670 --> 00:01:35,910 Now, as I said, ls has a lot of options. 32 00:01:35,910 --> 00:01:37,860 There's two of them that stand out, 33 00:01:37,860 --> 00:01:40,560 ls minus a is showing hidden files 34 00:01:40,560 --> 00:01:43,140 which are files that have a name starting with adult. 35 00:01:43,140 --> 00:01:46,710 And then there is ls minus l the long listing 36 00:01:46,710 --> 00:01:47,543 and you know what? 37 00:01:47,543 --> 00:01:51,589 You can combine them as well and make it ls minus la 38 00:01:51,589 --> 00:01:54,720 which shows a long listing of hidden files. 39 00:01:54,720 --> 00:01:57,300 In the long listing, you can see additional information 40 00:01:57,300 --> 00:02:01,050 about your files, like permissions and owners and creation 41 00:02:01,050 --> 00:02:04,084 date and time, which is all very useful. 42 00:02:04,084 --> 00:02:06,870 We'll talk about it later in much more detail. 43 00:02:06,870 --> 00:02:09,780 The purpose now is just to get you up and running as fast 44 00:02:09,780 --> 00:02:10,830 as possible. 45 00:02:10,830 --> 00:02:12,150 Now we have ip a. 46 00:02:12,150 --> 00:02:16,620 ip a is showing your IP address and what you should be 47 00:02:16,620 --> 00:02:19,650 looking for is your second interface. 48 00:02:19,650 --> 00:02:23,070 The first one is l0. l0 is looping. 49 00:02:23,070 --> 00:02:28,020 That's your internal IP stack, always set to 127.0.0.1. 50 00:02:28,020 --> 00:02:30,450 Look at the second one, ens33. 51 00:02:30,450 --> 00:02:34,807 And it's showing me that I haved IP address 192.168.29.141. 52 00:02:36,480 --> 00:02:37,991 And that can be convenient. 53 00:02:37,991 --> 00:02:41,610 If I want to make my system reachable, then 54 00:02:41,610 --> 00:02:45,298 another one is get, get works on text files. 55 00:02:45,298 --> 00:02:46,620 And you know what? 56 00:02:46,620 --> 00:02:49,440 On Linux, almost everything is stored as a text file. 57 00:02:49,440 --> 00:02:52,860 And if you want to read the contents of a text file 58 00:02:52,860 --> 00:02:54,990 you use get for example, get 59 00:02:54,990 --> 00:02:58,601 on etc hosts, which is a file that you can use 60 00:02:58,601 --> 00:03:00,900 for name resolution. 61 00:03:00,900 --> 00:03:04,170 That is the name belonging to a specific IP address. 62 00:03:04,170 --> 00:03:07,350 As you can see, not much interesting going on here. 63 00:03:07,350 --> 00:03:10,590 Right, then there is passwd. 64 00:03:10,590 --> 00:03:14,040 passwd allows you to change your current password. 65 00:03:14,040 --> 00:03:15,077 If you wanna do that 66 00:03:15,077 --> 00:03:18,090 you need to enter your current password first. 67 00:03:18,090 --> 00:03:20,280 That's your protection, just to make sure 68 00:03:20,280 --> 00:03:25,280 that nobody is changing your password as a joke or so. 69 00:03:25,920 --> 00:03:27,030 And what do I get? 70 00:03:27,030 --> 00:03:28,470 Oh, no bad password. 71 00:03:28,470 --> 00:03:30,450 Password is the same as the old one. 72 00:03:30,450 --> 00:03:32,370 Yes, it is right. And that is 73 00:03:32,370 --> 00:03:36,180 because I did not really want to change my password anyway. 74 00:03:36,180 --> 00:03:41,180 And you know what, if you have root privileges, then passwd 75 00:03:41,310 --> 00:03:45,480 minus minus help is showing so many interesting options 76 00:03:45,480 --> 00:03:47,550 but as you can see a root only 77 00:03:47,550 --> 00:03:49,890 so that means that you need to run them with sudo. 78 00:03:49,890 --> 00:03:52,140 We will talk about that later. 79 00:03:52,140 --> 00:03:54,336 Let me type touch, touch hello 80 00:03:54,336 --> 00:03:56,610 What is touch hello doing? 81 00:03:56,610 --> 00:03:59,733 That will create an empty file with the name hello. 82 00:04:01,230 --> 00:04:02,400 Why is it useful? 83 00:04:02,400 --> 00:04:03,233 Well, that is useful 84 00:04:03,233 --> 00:04:06,180 because in a Linux system, as an ordinary user 85 00:04:06,180 --> 00:04:08,910 you only have a limited write permissions. 86 00:04:08,910 --> 00:04:10,320 And if you want to verify 87 00:04:10,320 --> 00:04:13,407 that you can actually write to a specific location. 88 00:04:13,407 --> 00:04:15,706 Well, touch is an awesome command. 89 00:04:15,706 --> 00:04:19,320 In fact, this thing that I'm doing right here 90 00:04:19,320 --> 00:04:22,380 touch on hello to, to create an empty file 91 00:04:22,380 --> 00:04:23,670 with the name hello? 92 00:04:23,670 --> 00:04:27,449 Isn't even the real reason why touch was created. 93 00:04:27,449 --> 00:04:29,760 Let me do a touch hello again. 94 00:04:29,760 --> 00:04:32,670 And now let me do the ls minus l hello again. 95 00:04:32,670 --> 00:04:34,320 And do you see the difference? 96 00:04:34,320 --> 00:04:36,420 The difference is in the timestamp. 97 00:04:36,420 --> 00:04:37,353 If you use touch 98 00:04:37,353 --> 00:04:39,820 then you are going to change the timestamp on 99 00:04:39,820 --> 00:04:44,010 on the file to the moment when you ran touch. 100 00:04:44,010 --> 00:04:46,050 And that is functionality that can be useful 101 00:04:46,050 --> 00:04:48,480 in backup environments, but honestly 102 00:04:48,480 --> 00:04:50,370 nobody uses touch that way. 103 00:04:50,370 --> 00:04:53,760 People are using touch to verify writability. 104 00:04:53,760 --> 00:04:57,120 And that's something that you are going to do a lot as well. 105 00:04:57,120 --> 00:04:59,040 Finally, pwd 106 00:04:59,040 --> 00:05:02,550 for print working directory, that is showing you the name 107 00:05:02,550 --> 00:05:06,270 of the directory that you currently are in and in Linux. 108 00:05:06,270 --> 00:05:08,490 And we will talk about these directories a lot. 109 00:05:08,490 --> 00:05:11,160 In Linux you won't always see where you are in. 110 00:05:11,160 --> 00:05:14,550 If I type cd slash var slash log for instance, 111 00:05:14,550 --> 00:05:15,720 I only see log. 112 00:05:15,720 --> 00:05:18,830 And if I want to see the complete name, well 113 00:05:18,830 --> 00:05:20,610 pwd and oh, now, now 114 00:05:20,610 --> 00:05:24,390 that we are talking about cd for change directory anyway, 115 00:05:24,390 --> 00:05:26,820 if you use cd followed by nothing 116 00:05:26,820 --> 00:05:29,670 it'll always bring you back to your home directory. 117 00:05:29,670 --> 00:05:31,980 And do you see that you can easily recognize 118 00:05:31,980 --> 00:05:34,680 the home directory by the tilde? 119 00:05:34,680 --> 00:05:35,513 All right. 120 00:05:35,513 --> 00:05:38,010 I think that's all, that's eight commands so far. 121 00:05:38,010 --> 00:05:41,100 Let me throw in one more, which is history. 122 00:05:41,100 --> 00:05:43,290 History is a very convenient command. 123 00:05:43,290 --> 00:05:46,230 It allows you to verify all that you have just done. 124 00:05:46,230 --> 00:05:47,970 So here's my command history. 125 00:05:47,970 --> 00:05:49,380 That's all for this video. 126 00:05:49,380 --> 00:05:51,153 Let's move on to the next topic.