1 00:00:01,990 --> 00:00:06,820 In Lennox, nearly everything you deal with directly is a file. 2 00:00:07,270 --> 00:00:12,970 So and most often these will be text files, for instance, our configuration files. 3 00:00:13,270 --> 00:00:16,580 Um, in Lennox are text file senior. 4 00:00:17,280 --> 00:00:24,850 And so to reconfigure an application, you simply open the configuration file, change the text and 5 00:00:24,850 --> 00:00:27,400 save the file and then restart the application. 6 00:00:27,580 --> 00:00:32,080 So your reconfiguration is complete here. 7 00:00:32,320 --> 00:00:40,540 So now, with so many text files, manipulating text becomes circular in managing Linux and Linux applications. 8 00:00:40,840 --> 00:00:49,180 So in this lecture, actually in this field a several lectures here, you will use several common commands 9 00:00:49,180 --> 00:00:52,990 and techniques for manipulating text in Linux. 10 00:00:53,500 --> 00:01:03,280 For illustrative purposes, I will use files from the world's best network institution detection system 11 00:01:03,280 --> 00:01:04,240 and D. 12 00:01:04,240 --> 00:01:11,410 S Snored, which was first developed by Martin Rules, and it's now owned by Cisco. 13 00:01:11,860 --> 00:01:19,000 So NYDFS are commonly used to detect intrusions by hackers. 14 00:01:19,150 --> 00:01:22,900 So if you want to be a successful hacker, you must be familiar with. 15 00:01:23,230 --> 00:01:34,480 Our ways in I.T. is can um, detect detect attacks and the ways can abuse them to avoid detection. 16 00:01:35,200 --> 00:01:42,490 So let's now I will, uh, learn about, uh, you learn you, uh, the beeping fire. 17 00:01:42,510 --> 00:01:47,980 So, uh, the most basic text this will air command is probably kept here. 18 00:01:49,240 --> 00:02:01,450 So Cat is, uh, to let's use cats to, uh, display this not config file from snort dot con fear, 19 00:02:01,450 --> 00:02:02,650 as you can see here. 20 00:02:03,040 --> 00:02:13,510 So let's in order to open up this file that's right here, cats slash eight CC small snore. 21 00:02:13,540 --> 00:02:17,050 Start Quan Quan, OK. 22 00:02:21,020 --> 00:02:21,530 Actually. 23 00:02:29,810 --> 00:02:32,900 Actually, let's show and them bitcoin for cash. 24 00:02:43,500 --> 00:02:44,510 So you can see this. 25 00:02:44,960 --> 00:02:52,880 Now we printed our this file here, so, um, news can and should be like this here. 26 00:02:53,300 --> 00:03:01,520 So in the following two elections, I will show you an election and next, uh, the next, uh, lecture 27 00:03:01,520 --> 00:03:09,260 to I will show you to hear the detail and heat until, uh, comments, which are two methods for displaying 28 00:03:09,260 --> 00:03:15,230 just part of the finest content in order to, uh, more easily with the key content. 29 00:03:15,620 --> 00:03:17,300 So let's uh, right here. 30 00:03:17,510 --> 00:03:18,870 Heat here. 31 00:03:19,640 --> 00:03:25,880 Uh, it is the SNP s and P that can trigger action here. 32 00:03:25,880 --> 00:03:31,490 As you can see now we are simply looking at heat here and. 33 00:03:33,230 --> 00:03:34,460 Uh, we have. 34 00:03:40,670 --> 00:03:42,680 So now if you. 35 00:03:44,380 --> 00:03:48,130 And I just want to view the beginning of the file here. 36 00:03:48,490 --> 00:03:54,070 You can use the heat command as I used it here, but by default is common. 37 00:03:54,070 --> 00:04:03,070 This is the first ten lines of a fire, so one two three four five six seven eight nine 10 here. 38 00:04:03,820 --> 00:04:06,100 So the, uh, command, for instance. 39 00:04:06,910 --> 00:04:07,810 Uh, here. 40 00:04:10,230 --> 00:04:18,780 For example, just if you want to see the first five lines here, uh, just minus finds the five here. 41 00:04:19,140 --> 00:04:21,990 And then write your file here. 42 00:04:22,000 --> 00:04:26,790 So note in my case is not here, but you can do it in file. 43 00:04:28,710 --> 00:04:29,610 Actually, it's not. 44 00:04:30,760 --> 00:04:31,200 And. 45 00:04:32,570 --> 00:04:36,500 Actually, not as intense as an MP. 46 00:04:37,760 --> 00:04:45,890 As an MP, that can as you can see here, we pour into the first five lines here one two three four 47 00:04:45,890 --> 00:04:46,490 five. 48 00:04:47,970 --> 00:04:57,720 So you should look like that, you see and the article like that, if you if I know right here eight 49 00:04:57,720 --> 00:04:59,070 lines of actual. 50 00:05:00,840 --> 00:05:02,400 Here it lines. 51 00:05:05,620 --> 00:05:06,040 Here. 52 00:05:07,450 --> 00:05:07,730 Oops! 53 00:05:10,890 --> 00:05:12,570 It's an excellent yes. 54 00:05:13,930 --> 00:05:20,430 Hate crimes, for example, as you can see here, I printed eight lines of our. 55 00:05:22,000 --> 00:05:25,540 Configuration file here and here. 56 00:05:27,510 --> 00:05:28,100 I'm sorry. 57 00:05:31,350 --> 00:05:33,240 Let's change this resolution here. 58 00:05:33,450 --> 00:05:36,540 A resolution here. 59 00:05:40,830 --> 00:05:41,250 Yes. 60 00:05:42,930 --> 00:05:44,340 This configuration here. 61 00:05:48,770 --> 00:05:49,130 So. 62 00:05:50,530 --> 00:05:53,050 Notice here we have. 63 00:05:54,120 --> 00:05:54,770 Tatel. 64 00:05:56,070 --> 00:05:59,400 Uh, come on the spill tail, commander spill here. 65 00:05:59,640 --> 00:06:03,330 So the tail command is similar to the hit command. 66 00:06:04,850 --> 00:06:05,390 But. 67 00:06:08,820 --> 00:06:12,270 But it's used to weave the last lines of a file. 68 00:06:12,840 --> 00:06:17,340 So let's use this tail comb one this well here again. 69 00:06:18,040 --> 00:06:18,660 Uh, here. 70 00:06:20,720 --> 00:06:21,410 Tell. 71 00:06:22,570 --> 00:06:24,040 Here it is. 72 00:06:24,310 --> 00:06:27,940 It's an empire, it's MP that configuration here. 73 00:06:28,460 --> 00:06:33,460 Uh, but uh, so for example, it's as you can see, we're, uh, printed. 74 00:06:33,820 --> 00:06:39,970 These are all files here because we don't mentioned any, um, any. 75 00:06:43,810 --> 00:06:52,420 Last lions here, for example, if they try like that, for example, uh, minus five, this tail command 76 00:06:52,430 --> 00:07:02,860 will show us the last file of last five lines of our, uh, configuration file or any text file here. 77 00:07:03,880 --> 00:07:08,630 So, uh, we have then numbering the lines call months as well. 78 00:07:08,650 --> 00:07:15,190 So sometimes, especially with very long files, we may want the file to display line or line numbers 79 00:07:15,790 --> 00:07:16,300 signs. 80 00:07:16,600 --> 00:07:21,700 This is an empty configuration, has not many lines here. 81 00:07:22,060 --> 00:07:25,270 I will try another file here. 82 00:07:25,270 --> 00:07:31,540 For example, it's found in the file um, file, for example. 83 00:07:32,020 --> 00:07:33,400 Let's use. 84 00:07:35,090 --> 00:07:37,050 Somebody here, some. 85 00:07:38,810 --> 00:07:42,650 And SMB dot com, I think this moment, OK? 86 00:07:42,740 --> 00:07:46,670 As you can see, there is a swarming alliance, so. 87 00:07:48,260 --> 00:07:49,050 Mm hmm. 88 00:07:50,070 --> 00:07:58,530 We may want to file display and nine line numbers because it's so many lines here with some configuration 89 00:07:58,530 --> 00:07:59,220 file here. 90 00:07:59,790 --> 00:08:01,110 So let's. 91 00:08:03,030 --> 00:08:10,000 So this makes it easier to arrest and change and come back to the same place within the file, so to 92 00:08:10,020 --> 00:08:12,630 display a file with nine numbers. 93 00:08:13,380 --> 00:08:21,390 We chose the NFL, yes and l, uh, comments or simply enter the A comment here, et cetera. 94 00:08:22,260 --> 00:08:23,630 It is here. 95 00:08:23,640 --> 00:08:26,040 Um uh, what it was. 96 00:08:26,040 --> 00:08:27,150 It was humble, right? 97 00:08:29,360 --> 00:08:32,050 Yes, Samba Samba SMB configuration. 98 00:08:32,900 --> 00:08:35,190 Uh, Samba SMB. 99 00:08:35,480 --> 00:08:39,080 Com Fair, as you can see here, we printed a line like that. 100 00:08:39,620 --> 00:08:44,540 Uh, line last line is one hundred eight and nine line here. 101 00:08:45,080 --> 00:08:50,490 And as you can see here, we have so many lines here. 102 00:08:56,650 --> 00:08:56,980 Yes. 103 00:09:06,830 --> 00:09:10,220 So let's filter our files with. 104 00:09:11,840 --> 00:09:12,950 Com month here. 105 00:09:13,490 --> 00:09:21,710 So the command and grip is probably the most widely used takes manipulation command, so it lets you 106 00:09:21,710 --> 00:09:24,380 filter the content of a file for display. 107 00:09:25,250 --> 00:09:33,830 If, for instance, you want to see all lines that include word, for example, read on here or parts 108 00:09:33,830 --> 00:09:34,220 here. 109 00:09:35,440 --> 00:09:37,600 Uh, like that path here. 110 00:09:38,260 --> 00:09:38,860 Um. 111 00:09:41,790 --> 00:09:49,380 Uh, in your, uh, this SMB file configuration file, you called use camp and asked to display only 112 00:09:49,710 --> 00:10:00,240 to files like that, for example, cat ethicists, some with some assembly that configuration and one 113 00:10:00,390 --> 00:10:07,440 line pipe here and then grab, uh, grippier read uh, what it was. 114 00:10:07,440 --> 00:10:10,530 Uh, read only use it. 115 00:10:10,620 --> 00:10:12,450 Only read. 116 00:10:13,540 --> 00:10:18,880 As you can see here, we printed out all our red files here. 117 00:10:19,300 --> 00:10:31,690 So this command will first be, um, assembly configuration file and then using the pipe here to send 118 00:10:31,690 --> 00:10:35,800 it to grab, and which we will take the file as an input. 119 00:10:36,220 --> 00:10:40,600 So now look for license plate occurrences of the word read. 120 00:10:41,590 --> 00:10:45,430 And display only to lions here, as you can see here. 121 00:10:46,330 --> 00:10:54,520 So the grape command is very powerful and essential command for working in Linux because it can save 122 00:10:54,520 --> 00:11:00,190 you hearts of searching for every occurrence of a volt or command in file. 123 00:11:01,360 --> 00:11:01,780 So. 124 00:11:05,540 --> 00:11:14,180 Well, let's say you want to display the fine lines immediately before a line that says Step six to 125 00:11:14,180 --> 00:11:18,230 configure polygons using the LEDs for comment you just earned. 126 00:11:18,560 --> 00:11:21,080 So how have you how will you do it? 127 00:11:23,050 --> 00:11:23,470 So. 128 00:11:25,260 --> 00:11:25,820 And. 129 00:11:30,050 --> 00:11:37,760 So there are many options to this commander to, as we have discussed, so you can learn more commands 130 00:11:37,760 --> 00:11:48,230 by using the built in Linux men, for example, mentale here will show the health file of tail comb 131 00:11:48,290 --> 00:11:54,980 mounted as you can see here, or, uh, just press X and then enter to quit here. 132 00:11:56,960 --> 00:11:57,410 Yeah. 133 00:11:58,810 --> 00:12:02,920 Uh, our uh, you can press Q Command to create here. 134 00:12:03,250 --> 00:12:10,360 What example, man can't, as you can see here, we're showing, uh, health file of cat combattere 135 00:12:10,360 --> 00:12:12,220 or non amputee. 136 00:12:12,460 --> 00:12:15,940 So a man is, uh, helpful comment here. 137 00:12:16,000 --> 00:12:23,980 Uh, actually actually, it's application here, so it will help you to show the health files of, uh, 138 00:12:24,070 --> 00:12:24,550 your. 139 00:12:26,460 --> 00:12:27,600 Application of common. 140 00:12:27,990 --> 00:12:34,950 So there are many ways to solve this challenge, and he and I show you each line stretching to do it 141 00:12:34,950 --> 00:12:44,580 in one way and your find another method here so we can do it like that and how it is there some bar 142 00:12:45,200 --> 00:12:54,140 assembly that can fish and pipe here and grip right here. 143 00:12:54,210 --> 00:13:00,570 As you can see here, we bring that this here which so we can see that the line here in the. 144 00:13:04,870 --> 00:13:08,380 We pretend like that here, as you can see, or with lines. 145 00:13:09,780 --> 00:13:10,470 No. 146 00:13:11,950 --> 00:13:20,240 So as you can see here, we have, um, challenges done with Intel and grab command. 147 00:13:20,260 --> 00:13:27,580 As you can see here we have um, we used nail command, which is similar to Cat, but it solves the 148 00:13:27,580 --> 00:13:35,260 lines of numbers or in one hundred eighty two, uh, line we have read only yes, one hundred seventy 149 00:13:35,260 --> 00:13:35,710 four. 150 00:13:35,710 --> 00:13:39,160 We have read only here, as you can see here. 151 00:13:39,460 --> 00:13:42,860 So I will of, uh, video here and I'm waiting. 152 00:13:42,860 --> 00:13:43,840 Go in next picture.