1 00:00:00,280 --> 00:00:06,690 OK so this is my second time recording this video the first time I forgot to turn my microphone on and 2 00:00:07,140 --> 00:00:08,540 performed for my cat. 3 00:00:08,550 --> 00:00:09,870 So she approved of it. 4 00:00:09,900 --> 00:00:14,340 Let's see if you approve of it the second time around now that I have a little bit of practice. 5 00:00:14,340 --> 00:00:19,570 So we're going to be talking today is really talking about viewing creating and editing files. 6 00:00:19,710 --> 00:00:27,000 So I've already showed you the echo command if you recall we used echo to create a file. 7 00:00:27,000 --> 00:00:31,880 Right we created a hollowed out tax and we can just echo hello out to the terminal. 8 00:00:31,890 --> 00:00:35,530 We could say echo hello and I'll say hello back. 9 00:00:36,100 --> 00:00:40,540 So what we can do with Echo is we can use it to write to a file. 10 00:00:40,740 --> 00:00:55,220 So if we were to say echo hey and then we write it to hey that text well we can look and see that hey 11 00:00:55,220 --> 00:01:00,230 that text is here and you can see my files from the previous one. 12 00:01:00,230 --> 00:01:07,080 So I'm trying to come with more ways of saying hello but we're gonna use hey that text here. 13 00:01:07,700 --> 00:01:16,460 So if we can't pay that texts all Kat does is print out to the screen what is in a file it says hey 14 00:01:17,700 --> 00:01:18,020 OK. 15 00:01:18,050 --> 00:01:21,410 So let's say we want to append cat or we want a pen. 16 00:01:21,410 --> 00:01:24,500 Hey that text while we can tab up here. 17 00:01:24,590 --> 00:01:32,120 What if we just say hey again we've got this greater than symbol here and we're just putting it into 18 00:01:32,120 --> 00:01:36,200 the hate text file. 19 00:01:36,200 --> 00:01:38,330 Well that didn't work we didn't spend it. 20 00:01:38,330 --> 00:01:40,150 We actually overrode it. 21 00:01:40,160 --> 00:01:50,010 So what if what can we use to actually over append this here's what we can do is we could say hey again. 22 00:01:50,120 --> 00:01:51,010 Again. 23 00:01:51,110 --> 00:01:51,720 Right. 24 00:01:51,740 --> 00:01:57,810 Just to give us something different and we can add a second greater than symbol here. 25 00:01:57,820 --> 00:02:03,550 So now if we cat the file you can see that we actually appended to the end of it. 26 00:02:03,670 --> 00:02:11,350 So this becomes incredibly useful when we are either adding stuff to a list say we're gathering IP addresses 27 00:02:11,350 --> 00:02:17,710 or we just want to combine our lists or when we're creating a series of commands and we're going to 28 00:02:17,710 --> 00:02:20,230 use those commands to send all at once. 29 00:02:20,350 --> 00:02:24,850 We're going to cover that later when we're talk about file transfers and the penetration testing section 30 00:02:25,240 --> 00:02:32,140 where we use a set of commands like this on a Windows machine to actually transfer files via FTB is 31 00:02:32,140 --> 00:02:38,480 just so much easier than typing them all in one by one we can create a little document and run the document. 32 00:02:38,560 --> 00:02:44,710 So this becomes useful when we have a series of commands and for other reasons as well as you'll learn 33 00:02:44,710 --> 00:02:51,390 as you go on in your Linux career so we've talked about Echo and we've talked about cat. 34 00:02:51,390 --> 00:02:54,370 So let's talk about some other ways to create a file. 35 00:02:54,690 --> 00:02:59,970 We can use something called Touch and to say new file that tax. 36 00:02:59,970 --> 00:03:04,860 And if the less you could see that new file that Texas here. 37 00:03:04,860 --> 00:03:09,720 But if we cat new file there's nothing in there because we haven't put anything in there yet. 38 00:03:10,440 --> 00:03:11,940 So there's a few things that we can do. 39 00:03:11,970 --> 00:03:14,170 We could use echo and append the file. 40 00:03:14,190 --> 00:03:15,070 Right. 41 00:03:15,090 --> 00:03:20,300 We could also use a tool called Nano no Nano is a terminal text editor. 42 00:03:20,310 --> 00:03:23,430 There are other terminal text editors like VI in vim. 43 00:03:23,580 --> 00:03:28,220 I don't prefer those personally I like now the most some people have their preferences. 44 00:03:28,320 --> 00:03:31,170 So I encourage you to play around with any of them as you wish. 45 00:03:31,170 --> 00:03:36,820 Vi and them are the other two but for this course we're gonna be using nano. 46 00:03:37,020 --> 00:03:42,570 So if I say nano new file text I could type whatever I want in here 47 00:03:45,750 --> 00:03:54,990 and we're gonna be using nano a lot to create scripts to create python scripts and to edit shell code 48 00:03:55,020 --> 00:03:58,210 as we get into a little bit exploit development. 49 00:03:58,320 --> 00:04:07,590 So I'm going to hit control X I hit y for saving and then we'll save it to new file that text if we 50 00:04:07,590 --> 00:04:08,750 catch this. 51 00:04:08,760 --> 00:04:11,380 Now it says hey I could take whatever I want in here. 52 00:04:11,520 --> 00:04:13,380 So that's one way of editing it. 53 00:04:13,560 --> 00:04:22,440 Another way of editing it is using a graphical interface so we can use g at it and say new file and 54 00:04:22,600 --> 00:04:27,900 if you don't like using a terminal you're more than welcome to use it here. 55 00:04:28,080 --> 00:04:30,790 Just type in new line here and save it. 56 00:04:30,990 --> 00:04:36,420 And I I like using G edit it's a lot cleaner because I can you know highlight and delete I don't have 57 00:04:36,420 --> 00:04:40,630 to use my keyboard to navigate around like I do in the terminal. 58 00:04:40,650 --> 00:04:45,210 So if you have the option to use git it for sure but sometimes you're gonna be on another machine that's 59 00:04:45,210 --> 00:04:49,740 not your own or is headless and doesn't have a gooey that you're gonna have to use now. 60 00:04:49,740 --> 00:04:52,170 So get comfortable using both. 61 00:04:52,200 --> 00:04:56,820 So we say this let's go ahead and cat it out and see what happens. 62 00:04:57,100 --> 00:04:57,360 OK. 63 00:04:57,380 --> 00:05:02,820 You could see that the new line is in there so really that's the overview that I wanted to cover. 64 00:05:02,820 --> 00:05:09,480 So just know that you can create files pretty much using echo touch. 65 00:05:09,780 --> 00:05:12,660 And actually you can create files using nano as well. 66 00:05:12,690 --> 00:05:22,740 You say nano this is new that text although say hello control X say that you al s you could see this 67 00:05:22,740 --> 00:05:31,830 is new that text is right here so you can use all of these tools in different ways to create files. 68 00:05:31,840 --> 00:05:34,140 It's completely up to you how you want to do it. 69 00:05:34,140 --> 00:05:41,080 Personally what I'm creating a file I use nano and I just create a new shell script python script a 70 00:05:41,190 --> 00:05:42,060 text document. 71 00:05:42,060 --> 00:05:46,020 That way you could also do it using G edit as well. 72 00:05:46,020 --> 00:05:51,140 So just know that we're gonna be using this a lot and try to get comfortable with these. 73 00:05:51,300 --> 00:05:54,800 And from here we're going to be moving into controlling Kelly Services. 74 00:05:54,810 --> 00:05:59,400 So we're just going to briefly talk about what services you need running on boot and how to do that.