2.1 Command Line Survival Part 1

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *

Already have an account? Sign In »

5 hours 21 minutes
Video Transcription
all right. Hello and welcome to command line Survival part one for the command line Basics course here on Cyber Eri. So, uh, this module will take you into a bunch of different tips and techniques that you can use to really work through the command line and save time
and hopefully help get you much more comfortable with the command month.
So in this module, we're gonna learn auto complete techniques, learned how the Iraqis air utilized at the seal. I'm and understand How did you command history? These are all very important concepts that you need to understand why you're working at the command line.
All right, Pre assessment. So what is the best way to re cement a previously entered command is going to be a pressing the control key and H b open the bash History file and copy paste See used the up Arrow key or D press the control key. Nzt
We want to resubmit a previously entered command.
If he said see Thea, pero key, You're correct. It helps cycle through previously entered commands and it is very quick and easy to use.
Pressing the controlled keying H does not really do anything at the command line,
and it is true you're gonna open the Bash history file and copy and paste it into the command line window. But that's a lot of extra steps, and it's not very easy.
Ah, and then pressing the control key and Z actually ended any running process at the command line terminal, which will learn in the Arkham it online survival part one.
All right, so typing commands, uh, in order to type of command, you need to be able to identify what you're trying to accomplish. It's It's very easy to start typing commands without knowing exactly what you want to do.
So if you can understand what you're trying to do from the command line, then that'll help you choose which command to use, which which is what parameters and how to really attack your problem. So, like I was saying before, the command, uh, kind of syntax is you need the command, a switch and then a parameter.
So in this example, uh, we're going to search for a Rooney's grip, search for Frankenstein, and we're using the Tech or the Dash I switch. And if you look it up in the manual the dash I switch. It stands for a case insensitive.
So if we look for Frankenstein, it doesn't have to be capitalized. And it'll, uh,
grab matches for anything that is not capitalized.
And, uh,
you can always press the enter key to enter your command Pretty straightforward.
All right, Some very important commands that you need to understand. While you're working at the command line,
we have P D. V D stands for print Working directory. It shows the current directory you are in while you are in your cli. This is very useful. So you know what is, uh, where you're at in the file system.
Now, if you want to know what's inside of the director of urine, you're gonna use the DIR command for Windows or the L s command for Lennox
and dear stands for Directory and L s stands for listing.
And it lists everything in your present working directory, that working directory command that you just used and it will show all the files in there,
and then if you want to be able to move to a different directory, you're going to use the CD Command, which is change director, and that will help you move to different folders so you can look through use dirt or l s from there and be able to see what's in there.
Let me give you a quick example.
So for here, this is for Windows. If I
cheek, we're gonna do key to be different. Work directory.
Excuse me? Endure said this old change.
Ah, you're so everything in our directory here. This is for my personal folder.
And then if we want to change directory, CD
and desk top because we can see that there is a desktop folder here,
all right. And now we're inside the desktop folder. If you want to see what's inside of their i D i r an enter. And this is what we have inside my desktop folder that this is for Windows.
All right, so for Lennox, we're in its I p d v d.
And this will print are working directory, which is flash home slash user. And you can also tell because before the command line symbol, we have the Tilda, which, as you know, when Lennox is for the home folder,
and now if we want to see what's inside of this folder your type, at last for list.
And this shows everything inside of this folder.
Now, when I hire commend for doing as a security professional is to do Ellis Tank L A.
And that will list everything and show you ah, love the permissions for the files.
And it will also give any hidden files. So as you'll see right now,
uh, this was the first listing we got, and it showed all of these folders that I have, But these files were they not, as you know, our hidden files and Lennox and using the A switch and lets us see all the files, including the Hidden Files. So this bash history file
it is not in this first listing because it is a hidden file.
All right,
so let's move on.
So, auto complete techniques we use the tab Key tab. Completion is your friend. It will save you so much time.
So it will only complete within the president working directory that you're in. And if there are more than one match for something you're typing out, you can press tab twice and it will list all the matches. So let me show you hear that? Say done.
L s
don't be because we have a bunch of files. Three files here that have the be there,
and they all start with Bash.
So I pushed the tab there, and if I pushed have twice, it will show us all of the files that match that.
But let's say I wanted to change,
you know, go through the pseudo at his admin successful file. And that's a lot to type, right? Sweet type
pseudo sud right here.
And then tab, it will auto complete it. Also, I don't have to type it. And that's great.
If it saves my time, Saves your time.
Well, degree. All right. Arrow keys a cli We get the up and down key up scrolls through previous commands and down swirls back from the up key. Super useful. It will save you a lot of time because you were going to be constantly repeating commands. So let me show you that real quick.
So, uh, you could see a push. The up he here and we got back. Our previous command pushed the key again. R l s act l a L s p d. If I go back down the down arrow. You bring us back down through his commands.
That will save you a lot of time because you're going to be constantly resubmitting different commands that you were doing as a secured profession.
All right, command history for Windows. Pretty straightforward. We have the F seven key and you can also type doskey slash history. Now is important to note that there is no persistent command history in Windows by default. And if you want to save your command history in Windows, then
I'd recommend
typing the dusky slash History command
and then just copying pasting everything right out of the command window into a text file.
Other than that, there is no really kind of persistent command history like there is for Lennox.
So, like I was saying, for Lennox, there is tthe ee dot bash history file this in a home folder and that records a user's history in the bash in the shell. So if you as I showed up here in the top, right, if we do cat bash history,
uh, and you'll learn that the cat command is Furkan Captain eight. And it spits out anything in a file,
and it will show us that all the previous commands that I did for this easier account.
And then there's also the history commit where we can type. Uh, we'll show all the previous commands that we types this. Well,
all right, So post this segment
Which command tells you what director you're in? Is it a p r e d B folder
or D Echo? And we want to know which folder we are It.
And if you said a paedo VD for print Working directory. You're correct.
Uh, the folder command isn't a real command.
Ah, the cat command is used to spit out the contents of a file for kind Captain eat. And it's not for telling you what director you're in
and the Echo command is used. Thio, send text back out of the command line interface that you'll learn, but it's not to tell you which directory.
All right, so in this video, we learned out of complete techniques, learned how to use the arrow keys that air you lives at the sea life and understand how to view command history. And I hope to see you in the next video
Up Next