Time
5 hours 21 minutes
Difficulty
Beginner
CEU/CPE
6

Video Transcription

00:00
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
00:17
and hopefully help get you much more comfortable with the command month.
00:22
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.
00:37
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
00:56
We want to resubmit a previously entered command.
01:00
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.
01:08
Pressing the controlled keying H does not really do anything at the command line,
01:14
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.
01:25
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.
01:38
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.
01:55
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.
02:15
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.
02:34
So if we look for Frankenstein, it doesn't have to be capitalized. And it'll, uh,
02:38
grab matches for anything that is not capitalized.
02:43
And, uh,
02:45
you can always press the enter key to enter your command Pretty straightforward.
02:51
All right, Some very important commands that you need to understand. While you're working at the command line,
02:55
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.
03:08
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
03:17
and dear stands for Directory and L s stands for listing.
03:22
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,
03:30
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.
03:45
Let me give you a quick example.
03:47
So for here, this is for Windows. If I
03:52
cheek, we're gonna do key to be different. Work directory.
03:57
Excuse me? Endure said this old change.
04:00
Ah, you're so everything in our directory here. This is for my personal folder.
04:05
And then if we want to change directory, CD
04:10
and desk top because we can see that there is a desktop folder here,
04:15
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.
04:29
All right, so for Lennox, we're in its I p d v d.
04:32
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,
04:46
and now if we want to see what's inside of this folder your type, at last for list.
04:50
And this shows everything inside of this folder.
04:54
Now, when I hire commend for doing as a security professional is to do Ellis Tank L A.
05:00
And that will list everything and show you ah, love the permissions for the files.
05:08
And it will also give any hidden files. So as you'll see right now,
05:13
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
05:32
it is not in this first listing because it is a hidden file.
05:38
All right,
05:39
so let's move on.
05:41
So, auto complete techniques we use the tab Key tab. Completion is your friend. It will save you so much time.
05:48
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.
06:05
L s
06:09
don't be because we have a bunch of files. Three files here that have the be there,
06:15
and they all start with Bash.
06:19
So I pushed the tab there, and if I pushed have twice, it will show us all of the files that match that.
06:27
But let's say I wanted to change,
06:30
you know, go through the pseudo at his admin successful file. And that's a lot to type, right? Sweet type
06:38
pseudo sud right here.
06:41
And then tab, it will auto complete it. Also, I don't have to type it. And that's great.
06:46
If it saves my time, Saves your time.
06:48
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.
07:06
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.
07:24
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.
07:32
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
07:51
I'd recommend
07:53
typing the dusky slash History command
07:56
and then just copying pasting everything right out of the command window into a text file.
08:01
Other than that, there is no really kind of persistent command history like there is for Lennox.
08:07
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,
08:26
uh, and you'll learn that the cat command is Furkan Captain eight. And it spits out anything in a file,
08:33
and it will show us that all the previous commands that I did for this easier account.
08:39
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,
08:48
all right, So post this segment
08:50
Which command tells you what director you're in? Is it a p r e d B folder
08:54
Seacat
08:56
or D Echo? And we want to know which folder we are It.
09:01
And if you said a paedo VD for print Working directory. You're correct.
09:05
Uh, the folder command isn't a real command.
09:09
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
09:18
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.
09:30
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

Command Line Basics

In this course you will learn the fundamentals of Command Line, a fundamental tool for any user of Windows and Linux machines. Command line allows developers to manipulate files easily and quickly. Learning command line saves developers time and resources.

Instructed By

Instructor Profile Image
Christopher Haller
Senior Intelligence Operations Analyst at Centripetal
Instructor