Instructor: Okay, now that we had a quick overview 2 2
of Kali Linux, I want to spend some time talking 3 3
about the Linux terminal. 4 4
So you can access the terminal 5 5
through this application right here, 6 6
so if we click on that, 7 7
it'll open the terminal window for us 8 8
and as you can see, all it is 9 9
is a black screen where you can type commands. 10 10
Now, the Linux terminal 11 11
is actually very, very powerful 12 12
because it can be used to do anything 13 13
that you can think of really. 14 14
A lot of the applications in Linux 15 15
that have a graphical interface 16 16
where command prompt programs first 17 17
and then people made a graphical interface for it. 18 18
So a lot of the time, maybe the graphical interface 19 19
will be buggy or crash 20 20
and the terminal program will still work. 21 21
Also, a lot of the penetration testing tools 22 22
do not even have a graphical interface. 23 23
A lot of them can only be used 24 24
throughout the terminal. 25 25
Not only that, but in many scenarios, 26 26
you might only have an SSH or a command prompt access 27 27
to a machine. 28 28
So you need to know how to use this command prompt 29 29
in order to achieve your goals. 30 30
So throughout the course, 31 31
we're gonna be using the terminal a lot 32 32
and that's why I want to spend some time 33 33
just showing you the basics of it 34 34
and making sure that you're gonna be comfortable using it. 35 35
Now, the basic idea is you type a command 36 36
and the result will be displayed for you on screen. 37 37
So let's have a look on a very, very simple command 38 38
which is pwd. 39 39
Now, this command prints the current working directory, 40 40
hence the name pwd. 41 41
So if I hit Enter, 42 42
you can see it's printing /root 43 43
which means right now I am in the root directory. 44 44
So basically I am in here. 45 45
This is the root, it's home. 46 46
So if I do ls which is a command 47 47
to list all the directories and files 48 48
in the current working directory, 49 49
we should get all of these directories 50 50
that we see in here. 51 51
So if I hit Enter, 52 52
as you can see, I can see all these directories 53 53
in the current working directory. 54 54
Now, another very useful command 55 55
is the cd command. 56 56
This command allow us to navigate into another directory. 57 57
So for example, let's say I want to navigate 58 58
into the Downloads. 59 59
All we have to do is type cd, 60 60
followed by the name of the directory 61 61
that I want to navigate to. 62 62
So I'm gonna type Downloads. 63 63
Now if I hit Enter, 64 64
I should be inside the Downloads now. 65 65
So if I do pwd to see my current working directory, 66 66
you'll see that it's saying I'm in root/Downloads. 67 67
So if I do ls here, 68 68
it should show me all the directories 69 69
and files inside Downloads. 70 70
So if I do Enter, 71 71
as you can see, I have a directory 72 72
and a file in here 73 73
and these are the exact same files 74 74
that you'll see if you double click the Downloads here. 75 75
Now, if you want to go back one directory, 76 76
so similar to pressing the back button in here, 77 77
all we have to do is do cd, 78 78
again the command to change the working directory 79 79
followed by .. 80 80
And now if I do pwd, 81 81
you'll see I'm back in root 82 82
and if I do ls, 83 83
you'll see all the directories and files in root. 84 84
So that's all good. 85 85
And there's actually a huge number of commands 86 86
that you can use. 87 87
So I'm going to include a link 88 88
in the resources of this lecture 89 89
of all the Linux commands that you can use. 90 90
You don't need to know them by heart. 91 91
We're actually gonna be using a lot of them 92 92
throughout the course 93 93
so you're going to naturally learn them 94 94
as you go through the course. 95 95
Now, if you are using a command 96 96
and you're not sure about how this command works, 97 97
you can just use the man command 98 98
to display the manual of this command. 99 99
For example, we've used the ls command here 100 100
to list the files and directories 101 101
in the current working directory. 102 102
But if I do man followed by ls, 103 103
this basically means I'm requesting the manual of ls 104 104
so I'm asking how can I use the ls command? 105 105
So if I hit Enter, 106 106
you'll see I'll get a screen similar to a text file 107 107
and basically it's giving me a lot of information 108 108
on how to use the ls command. 109 109
So you can see that it's telling us 110 110
that this command will list the directory contents. 111 111
You can see the way it works by typing ls 112 112
followed by the options followed by a file 113 113
if you want to run it on a file. 114 114
You can see a longer description 115 115
of the command. 116 116
And then, you can see all the options 117 117
and the arguments that we can use with this command. 118 118
Now, in Linux, most of the time, 119 119
the options will always follow the same syntax. 120 120
So you either use dash letter or dash dash a word 121 121
to specify the argument. 122 122
For example, in here, the -a and --all 123 123
will ignore entries starting with dot. 124 124
So if you keep going down in here, 125 125
you'll see all the options and arguments you can use 126 126
with the ls command 127 127
and we have another example here. 128 128
We have the -l 129 129
which means it's going to use a long listing format 130 130
which will display more information 131 131
about the files in the current working directory. 132 132
So let's have a look on that. 133 133
I'm gonna press Q to exit this 134 134
and then we're gonna do ls as usual 135 135
and since we read the manual, 136 136
we know we can do -l to see more information 137 137
about the files 138 138
and if I hit Enter now, 139 139
you can see I'm still getting the same directories 140 140
but it's also showing me the permissions, 141 141
the users, the date created and so on. 142 142
So you can use the man command 143 143
on any command you want, 144 144
not only on the ls. 145 145
So you can use it on the pwd, 146 146
you can use it on the cd 147 147
or any other command 148 148
and it'll show you a full description 149 149
or the manual page of how to use this command. 150 150
Now, I'm going to clear the screen 151 151
by typing clear. 152 152
And the next thing that I wanna show you 153 153
is the --help. 154 154
So this is something that you can use again 155 155
in almost all commands and all programs in Linux. 156 156
So you can just type the program name 157 157
or the command name followed by --help. 158 158
As you might think, 159 159
this will show you a help message telling you 160 160
what this command is 161 161
or what this program is, 162 162
the arguments that it takes, 163 163
how to use these arguments 164 164
and examples at the bottom. 165 165
Now, another useful thing with the terminal, 166 166
so I'm gonna clear this again 167 167
is the arrows. 168 168
So you can press up to go up to see all the commands 169 169
that we executed before 170 170
and again, you can go down to see to navigate 171 171
between the commands that you executed previously. 172 172
You can also use the Tab for autocomplete. 173 173
So again, let's do ls 174 174
and you can see all the files 175 175
and let's say we want to go into Documents. 176 176
So we can do cd followed by Documents. 177 177
You can type Documents 178 178
or if you're lazy like me, 179 179
you can just do Doc and press Tab 180 180
and as you can see, it's automatically completing 181 181
the rest of the word for me. 182 182
So this is something that comes very, very handy 183 183
when you're using the terminal for a long time. 184 184
Now, what I also wanna show you 185 185
is how to install programs in Kali from the terminal. 186 186
So first, I'm gonna clear this. 187 187
And the first thing that you wanna do 188 188
is update the sources where Kali can search 189 189
and download programs from. 190 190
So we're gonna do apt-get update. 191 191
Now apt-get is the name of the application 192 192
that allow us to download and install programs 193 193
and we're saying update 194 194
because I'm saying that I want you to update the list 195 195
of all the programs that I can install. 196 196
So I'm gonna hit Enter 197 197
and you wanna make sure that you have internet connection 198 198
when running this. 199 199
And as you can see, it's telling me that it's done. 200 200
And now, we can go ahead and start installing applications. 201 201
So the first program that I wanna install 202 202
is actually a terminal program, 203 203
so similar to this one 204 204
but it allow us to have multiple terminal windows open 205 205
in the same window. 206 206
So in order to install a program 207 207
through the command-line, 208 208
we're gonna do apt-get which is again, 209 209
the name of the program that allows us to install programs 210 210
on the system. 211 211
We're gonna say that I want to install 212 212
and the program that I want to install 213 213
is called terminator. 214 214
So very, very simple. 215 215
First of all, we're typing the name of the command 216 216
which is apt-get. 217 217
We're saying that I want to install 218 218
and the program name that I wanna install 219 219
is called terminator. 220 220
So I'm gonna hit Enter 221 221
and this is going to download and install terminator for me. 222 222
So you can use the same command to install any program 223 223
that you want, 224 224
you just need to replace terminator with the name 225 225
of the program that you want to install. 226 226
Now, I've already downloaded and installed this before 227 227
so it didn't ask me to confirm. 228 228
But if you're running this for the first time, 229 229
it might ask you to confirm 230 230
whether or not you actually want to install this program 231 231
so all you'd have to do 232 232
is press Y from the keyboard and hit Enter. 233 233
Now, as you can see, it's done 234 234
so if I go to my all applications in here, 235 235
and just type terminator, 236 236
you can see that I have it here. 237 237
So I'm actually gonna drag it 238 238
and put it in my dock so I can access it easily 239 239
in the future. 240 240
So now I can just click it in here. 241 241
And that'll open terminator for me. 242 242
Now, this is another application 243 243
that allow me to run commands 244 244
so it's exactly the same as this 245 245
so again, I can do ls and pwd. 246 246
The only difference is with this one, 247 247
I can actually right click 248 248
and click on Split Horizontally, for example, 249 249
and this will split the same screen into two screens 250 250
where I can run commands at the same time. 251 251
So I can have some commands in here, 252 252
and I can run commands in here. 253 253
And then I can even split this more 254 254
if I want again vertically 255 255
or horizontally and as you can see, 256 256
I can have as many terminal windows as I want 257 257
and this'll be very helpful in the future 258 258
when we'll be running a number of programs 259 259
and a number of commands at the same time.