2.2 Useful Commands (KL)

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

Already have an account? Sign In »

Time
2 hours 9 minutes
Difficulty
Beginner
CEU/CPE
1
Video Transcription
00:00
>> Hello, and welcome to this Kali Fundamentals lesson.
00:00
I'm your host Robert Smith and
00:00
I'm excited to be here with you today.
00:00
We've gone over some things like commands
00:00
to navigate the file system,
00:00
some very high-level overviews
00:00
of permissions, things of that nature.
00:00
But you may be wondering,
00:00
there's still a lot of commands out there.
00:00
There's some things I may not know.
00:00
What are some additional things that
00:00
I could learn that'll help me to get
00:00
around Linux and Kali and things of that nature.
00:00
Well, today we're going to jump into those things.
00:00
We're going to get some basic understanding
00:00
of some useful commands.
00:00
We're going to see how those commands can be used,
00:00
and again we'll continue to build on this foundation that
00:00
we've put together and go from there.
00:00
I'm going to go ahead and bring in
00:00
my copy of Kali that I've installed here,
00:00
and you'll see that I've got a terminal opened
00:00
up and we're currently in the desktop folder.
00:00
With that in mind I've got
00:00
a few things I wanted to show you.
00:00
You may be thinking,
00:00
I have an Internet connection,
00:00
I can look up commands and
00:00
understand what they do but what happens if you don't,
00:00
or what if you just want to see
00:00
a quick easy lookup of a command or something like that.
00:00
Well, I'd like to introduce you
00:00
to the man command or manual.
00:00
When you type man and a command like ping let's say,
00:00
it pulls up a bunch of information.
00:00
As you can see here, it gives you
00:00
the name of the command at the top,
00:00
a quick synopsis,
00:00
it gives you a short description,
00:00
some options and as you scroll
00:00
through down towards the bottom
00:00
of all these different things that it provides,
00:00
it's got a packet details
00:00
and some additional information.
00:00
Lot of cool stuff there.
00:00
Now, there's multiple ways to use this.
00:00
We can hit "Q," and that takes us
00:00
back to our desktop here.
00:00
We'll do a quick clear to bring that back up.
00:00
Now, we talked about cat or concatenate.
00:00
You'll see over here to the left I've got this
00:00
hello bash file that I've created.
00:00
If I type cat and do hello,
00:00
it shows me the output for that file.
00:00
As you can see here I've got some line that I've
00:00
written here for starting a bash script,
00:00
and then I use this command called echo.
00:00
You might be wondering, well, what
00:00
does echo do? What does that mean?
00:00
Well, if we do man echo,
00:00
like we were looking at earlier.
00:00
As you can see it displays the name,
00:00
gives you some descriptions.
00:00
It says here it displays a line of text.
00:00
This can be useful if we're writing
00:00
a bash script and we need an output where we want
00:00
it to reference something and produce
00:00
an output from the system or something of that nature.
00:00
We can do that using the echo command.
00:00
That's going to be useful for you when you start
00:00
working on scripting and things of that nature,
00:00
and you're jumping into trying to make
00:00
some more complex ways of doing
00:00
things or simplifying things and things of that nature.
00:00
Now, you can easily use leaf pad down here,
00:00
and edit texts and
00:00
do things of that nature and edit files.
00:00
But let's say I'm here on this desktop folder,
00:00
and I just want to jump straight into that text file or
00:00
that batch file I can do nano and
00:00
hello and bam, there we are.
00:00
I've got my text editor opened now.
00:00
There are several different types of
00:00
text editors that you can use.
00:00
I like to use nano,
00:00
some folks like the eyes,
00:00
some other things like that.
00:00
But in this case this is what I like to use.
00:00
Now, as you can see here I
00:00
typed echo and then hello world.
00:00
Let's say I want to make it a little
00:00
more exciting and happy.
00:00
I do Hello world and two
00:00
exclamation points here on the end.
00:00
As you can see down at the bottom,
00:00
it gives you some commands that you can use,
00:00
you typically hold control and hit the letter.
00:00
I'll hit "Control O" to write out.
00:00
I'm going to do hello new, hit "Enter".
00:00
Select the S by hitting
00:00
Y and then I'll hit "Control X" to exit the text editor.
00:00
Now when I do cat,
00:00
hellonew, we'll see that that's made the change for me.
00:00
Then from there I can do a quick bash,
00:00
hellonew, and bam,
00:00
there it is, hello world using
00:00
that echo command. That's awesome.
00:00
Now, we know that we're root.
00:00
We'll jump into the next command here. I am root.
00:00
Let's say that I'm a different user
00:00
or you're a pen tester or security tester.
00:00
You got into a system.
00:00
You want to know what permissions the user account has.
00:00
Well, you can use the command called id,
00:00
and that gives you an output of the permissions that
00:00
the account that you're currently logged into has.
00:00
That's a good useful thing to have.
00:00
Let's say you need to install something.
00:00
You notice, I'm the root user,
00:00
I can install new programs,
00:00
applications, but how much space do I have?
00:00
How much information can I
00:00
really store on this drive right now?
00:00
Df will show us the free disk space or
00:00
the disk space that's free on
00:00
the system and where everything's at,
00:00
and it gives you this nice layout
00:00
here of what's been used on
00:00
the right when it's
00:00
mounted on as far as the share what have you,
00:00
available space, huge space, etc.
00:00
That's a quick and easy way to do
00:00
some troubleshooting or check to
00:00
see how much free space you have.
00:00
Now, I'm going to introduce you
00:00
to what I think is one of the most important commands,
00:00
which is passwd, which is password for short.
00:00
When we hit "Enter" it asks me for a new password.
00:00
I'm going to go ahead and update that [NOISE].
00:00
Oops, Looks like we made a mistake.
00:00
Well, we can't see what we're doing.
00:00
But that's okay, if I had done that
00:00
correctly what it would have done is
00:00
updated my password and that's very much
00:00
important when you inherited a system,
00:00
when you work on a system day to day,
00:00
and maybe you need to change
00:00
the password or something of that nature or you
00:00
don't want the default credentials on
00:00
something then in a Linux environment you can use
00:00
that passwd command and it will
00:00
allow you to change the password.
00:00
I know that was a lot of information.
00:00
Those are the commands that we want to start with
00:00
and the things that we want to learn to use.
00:00
Those are going to be fundamental in
00:00
helping you to not only edit
00:00
files and produce better scripts
00:00
and things of that nature.
00:00
But they're going to give you
00:00
that foundational toolset to continue to move deeper and
00:00
deeper into your understanding of
00:00
not just Kali but Linux platforms as a whole.
00:00
Now that we've gone through that together,
00:00
let's do a quick check on learning.
00:00
Which command describes and
00:00
shows you how to use other commands.
00:00
Now, thinking about that,
00:00
remember df is going to show us disk space that's free.
00:00
Df down here, nano was our text editor.
00:00
That's going to allow me to edit files,
00:00
edit content, make scripts,
00:00
do things of that nature.
00:00
Cat, allowed me to pull
00:00
the output out of the file and
00:00
display it in the terminal like we did.
00:00
Cat hellonew or cat hello,
00:00
and that showed us all of the content of the file.
00:00
The last choice that we have here is man,
00:00
which is short for manual
00:00
that shows us what a command does,
00:00
a description of the command and
00:00
gives us a lot of good information on what we can
00:00
do with respect to different switches and
00:00
things of that nature with
00:00
those commands that we put after man.
00:00
In summary, in this very brief lesson today,
00:00
we discussed the following.
00:00
The man command, the cat command,
00:00
echo, nano, id, df,
00:00
and password or passwd for short.
00:00
All of those are important because man has
00:00
given us instructions on how to use commands.
00:00
Cat gives us outputs if we don't want to
00:00
open the file or look in a text editor.
00:00
Echo is going to allow us to do
00:00
some things like write scripts,
00:00
display information, output information.
00:00
It's a great command to have in your toolchest.
00:00
Nano is great for editing text files,
00:00
but it's not the only text editor out there.
00:00
Id is great for understanding permissions,
00:00
df is good for understanding
00:00
disk space utilization and
00:00
where we might be able to clean some things up,
00:00
and passwd is fundamental in ensuring that we change
00:00
our password or that we don't
00:00
use default credentials on a system.
00:00
I know that that was brief but I
00:00
enjoyed having you here today,
00:00
and I look forward to seeing you again soon.
Up Next