Instructor: Okay, now that we had a quick overview
of Kali Linux, I want to spend some time talking
about the Linux terminal.
So you can access the terminal
through this application right here.
So if we click on that,
it'll open the terminal window for us.
And as you can see, all it is is a black screen
where you can type commands.
Now, the Linux terminal is actually very, very powerful
because it can be used to do anything
that you can think of really.
A lot of the applications in Linux
that have a graphical interface
were command prompt programs first
and then people made a graphical interface for it.
So a lot of the time, maybe the graphical interface
will be buggy or crash
and the terminal program will still work.
Also, a lot of the penetration testing tools
do not even have a graphical interface.
A lot of them can only be used
throughout the terminal.
Not only that but in many scenarios,
you might only have an SSH or a command prompt access
to a machine.
So you need to know how to use this command prompt
in order to achieve your goals.
So throughout the course,
we're gonna be using the terminal a lot
and that's why I want to spend some time
just showing you the basics of it
and making sure that you're gonna be comfortable using it.
Now, the basic idea is you type a command
and the result will be displayed for you on screen.
So let's have a look on a very, very simple command,
which is pwd.
Now, this command prints the current working directory,
hence the name pwd.
So if I hit Enter,
you can see it's printing /root,
which means right now I am in the root directory.
So basically, I am in here.
This is the root, it's home.
So if I do ls,
which is a command to list all the directories and files
in the current working directory,
we should get all of these directories
that we see in here.
So if I hit Enter, as you can see,
I can see all these directories
in the current working directory.
Now, another very useful command is the cd command.
This command allow us to navigate into another directory.
So for example, let's say I want to navigate
into the Downloads.
All we have to do is type cd,
followed by the name of the directory
that I want to navigate to.
So I'm gonna type Downloads.
Now, if I hit Enter,
I should be inside the Downloads now,
so if I do pwd to see my current working directory,
you'll see that it's saying I'm in /root/Downloads.
So if I do ls here,
it should show me all the directories
and files inside Downloads.
So if I do Enter,
as you can see, I have a directory
and the file in here
and these are the exact same files
that you'll see if you double click the Downloads here.
Now, if you want to go back one directory,
so similar to pressing the back button in here,
all you have to do is cd,
again the command to change the working directory,
followed by the dot
and now if I do pwd,
you'll see I'm back in root
and if I do ls,
you'll see all the directories and files in root.
So that's all good.
And there's actually a huge number
of commands that you can use.
So I'm going to include a link
in the resources of this lecture
of all the Linux commands that you can use.
You don't need to know them by heart.
We're actually gonna be using a lot of them
throughout the course,
so you're going to naturally learn them
as you go through the course.
Now, if you are using a command
and you're not sure about how this command works,
you can just use the man command
to display the manual of this command.
For example, we've used the ls command here
to list the files and directories
in the current working directory
but if I do man, followed by ls,
this basically means I'm requesting the manual of ls.
So I'm asking how can I use the ls command?
So if I hit Enter,
you'll see I'll get a screen similar
to a text file and basically,
it's giving me a lot of information
on how to use the ls command.
So you can see that it's telling us
that this command will list the directory contents.
You can see the way it works by typing ls,
followed by the options, followed by a file
if you want to run it on a file.
You can see a longer description of the command.
And then you can see all the options
and the arguments that we can use with this command.
Now, in Linux, most of the time,
the options will always follow the same syntax.
So you either use dash letter
or dash, dash a word
to specify the argument.
For example, in here, the -a and --all
will ignore entries starting with dot.
So if you keep going down in here,
you'll see all the options and arguments you can use
with the ls command
and we have another example here.
We have the -l,
which manes it's going to use a long listing format,
which will display more information
about the files in the current working directory.
So let's have a look on that.
I'm gonna press Q to exit this.
And then we're gonna do ls as usual
and since we read the manual,
we know we can do -l to see more information
about the files.
And if I hit Enter now,
you can see I'm still getting the same directories
but it's also showing me the permissions,
the users, the date created and so on.
So you can use the man command
on any command you want,
not only on the ls.
So you can use it on the pwd,
you can use it on the cd
or any other command
and it'll show you a full description
or the manual page of how to use this command.
Now, I'm going to clear the screen by typing clear.
And the next thing that I wanna show you
is the --help.
So this is something that you can use again
in almost all commands and all programs in Linux.
So you can just type the program name
or the command name, followed by --help.
As you might think, this will show you a help message,
telling you what this command is
or what this program is,
the arguments that it takes,
how to use these arguments
and examples at the bottom.
Now, another useful thing
with the terminal, so I'm gonna clear this again,
is the arrows.
You can press up to go up to see all the commands
that we executed before
and again, you can go down to see to navigate
between the commands that you executed previously.
You can also use the tab for auto complete.
So again, let's do ls
and you can see all the files.
And let's say we want to go into Documents.
So we can do cd followed by Documents.
You can type Documents
or if you're lazy like me,
you can just do Doc and press Tab
and as you can see, it's automatically completing the rest
of the word for me.
So this is something that comes very, very handy
when you're using the terminal for a long time.
Now, what I also wanna show you
is how to install programs in Kali from the terminal.
So first, I'm gonna clear this.
And the first thing that you wanna do
is update the sources where Kali
can search and download programs from.
So we're gonna do apt-get update.
Now, apt-get is the name of the application
that allow us to download and install programs
and we're saying update
because I'm saying that I want you to update the list
of all the programs that I can install.
So I'm gonna hit Enter.
And you wanna make sure that you have internet connection
when running this.
And as you can see, it's telling me that it's done
and now we can go ahead and start installing applications.
So the first program that I wanna install
is actually a terminal program,
so similar to this one,
but it allow us to have multiple terminal windows open
in the same window.
So in order to install a program
through the command line,
we're gonna do apt-get, which is again,
the name of the program
that allow us to install programs on the system.
We're gonna say that I want to install
and the program that I want to install
is called terminator.
So very, very simple.
First of all, we're typing the name of the command,
which is apt-get.
We're saying that I want to install
and the program name
that I wanna install is called terminator.
So I'm gonna hit Enter.
And this is going to download and install terminator for me.
So you can use the same command to install any program
that you want.
You just need to replace terminator
with the name of the program
that you want to install.
Now, I've already downloaded
and installed this before,
so it didn't ask me to confirm.
But if you're running this for the first time,
it might ask you to confirm whether or not you actually want
to install this program.
So all you'd have to do is press Y
from the keyboard and hit Enter.
Now, as you can see, it's done.
So if I go to my all applications in here,
and just type terminator,
you can see that I have it here.
So I'm actually gonna drag it
and put it in my dock so I can access it easily
in the future.
So now I can just click it in here
and that'll open terminator for me.
Now, this is another application
that allow me to run commands.
So it's exactly the same as this.
So again, I can do ls and pwd.
The only difference is with this one,
I can actually right click
and click on Split Horizontally, for example,
and this will split the same screen
into two screens where I can run commands at the same time.
So I can have some commands in here
and I can run commands in here.
And then I can even split this more if I want,
again vertically or horizontally
and as you can see,
I can have as many terminal windows as I want
and this will be very helpful in the future
when we'll be running a number of programs
and a number of commands at the same time.
Now, before I let you go,
I just want to show you two websites
that I'm gonna include in the resources
of this lecture.
First of all, we have a website here
that includes the most common Linux commands,
if not all.
So you can go through them and familiarize yourself
with them, but keep in mind,
you don't need to know them all by heart.
Like I said, as you go through my course
and as you continue on with your journey,
you will learn the commands that you need as you go.
Another really useful resource
that I'm gonna include is explainshell.com.
This website is designed to explain Linux commands to you.
So all you have to do is type the commands in here.
So for example, if you just type ls,
and hit Explain,
it'll explain that ls will list directory content.
You could make it more complex
and do ls -la
and if we hit Enter now,
it'll break all the arguments
and explain every single argument.
So again, ls lists contents.
If we highlight the l,
as you can see, it's telling us
that it's going to use a long listing format
as we've seen earlier
and the a at the end is the same as -a,
which is all, which means that we do not want
to ignore entries starting with a dot,
so we do not want to ignore hidden files.
So you can do any command in here.
You can do apt-get install for example
and I'll actually explain it to you.
So it'll explain apt is a package manager
and install can be used to install packages and so on.
So if you ever see a Linux command
that you don't understand,
you can always just come in here,
put the command and it'll break it down to you
and explain it really nicely.