OK so this is my second time recording this video the first time I forgot to turn my microphone on and
performed for my cat.
So she approved of it.
Let's see if you approve of it the second time around now that I have a little bit of practice.
So we're going to be talking today is really talking about viewing creating and editing files.
So I've already showed you the echo command if you recall we used echo to create a file.
Right we created a hollowed out tax and we can just echo hello out to the terminal.
We could say echo hello and I'll say hello back.
So what we can do with Echo is we can use it to write to a file.
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
that text is here and you can see my files from the previous one.
So I'm trying to come with more ways of saying hello but we're gonna use hey that text here.
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
OK.
So let's say we want to append cat or we want a pen.
Hey that text while we can tab up here.
What if we just say hey again we've got this greater than symbol here and we're just putting it into
the hate text file.
Well that didn't work we didn't spend it.
We actually overrode it.
So what if what can we use to actually over append this here's what we can do is we could say hey again.
Again.
Right.
Just to give us something different and we can add a second greater than symbol here.
So now if we cat the file you can see that we actually appended to the end of it.
So this becomes incredibly useful when we are either adding stuff to a list say we're gathering IP addresses
or we just want to combine our lists or when we're creating a series of commands and we're going to
use those commands to send all at once.
We're going to cover that later when we're talk about file transfers and the penetration testing section
where we use a set of commands like this on a Windows machine to actually transfer files via FTB is
just so much easier than typing them all in one by one we can create a little document and run the document.
So this becomes useful when we have a series of commands and for other reasons as well as you'll learn
as you go on in your Linux career so we've talked about Echo and we've talked about cat.
So let's talk about some other ways to create a file.
We can use something called Touch and to say new file that tax.
And if the less you could see that new file that Texas here.
But if we cat new file there's nothing in there because we haven't put anything in there yet.
So there's a few things that we can do.
We could use echo and append the file.
Right.
We could also use a tool called Nano no Nano is a terminal text editor.
There are other terminal text editors like VI in vim.
I don't prefer those personally I like now the most some people have their preferences.
So I encourage you to play around with any of them as you wish.
Vi and them are the other two but for this course we're gonna be using nano.
So if I say nano new file text I could type whatever I want in here
and we're gonna be using nano a lot to create scripts to create python scripts and to edit shell code
as we get into a little bit exploit development.
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
catch this.
Now it says hey I could take whatever I want in here.
So that's one way of editing it.
Another way of editing it is using a graphical interface so we can use g at it and say new file and
if you don't like using a terminal you're more than welcome to use it here.
Just type in new line here and save it.
And I I like using G edit it's a lot cleaner because I can you know highlight and delete I don't have
to use my keyboard to navigate around like I do in the terminal.
So if you have the option to use git it for sure but sometimes you're gonna be on another machine that's
not your own or is headless and doesn't have a gooey that you're gonna have to use now.
So get comfortable using both.
So we say this let's go ahead and cat it out and see what happens.
You could see that the new line is in there so really that's the overview that I wanted to cover.
So just know that you can create files pretty much using echo touch.
And actually you can create files using nano as well.
You say nano this is new that text although say hello control X say that you al s you could see this
is new that text is right here so you can use all of these tools in different ways to create files.
It's completely up to you how you want to do it.
Personally what I'm creating a file I use nano and I just create a new shell script python script a
text document.
That way you could also do it using G edit as well.
So just know that we're gonna be using this a lot and try to get comfortable with these.
And from here we're going to be moving into controlling Kelly Services.
So we're just going to briefly talk about what services you need running on boot and how to do that.