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