All language subtitles for الإنجليزية (تم إنشاؤها تلقائيًا)_en_0_the Linux File System explained in 1_233 seconds __ Linux for Hackers __ EP 2(1080P_HD)
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,080 --> 00:00:03,199
welcome to linux for hackers and
2
00:00:02,720 --> 00:00:05,279
everyone
3
00:00:03,199 --> 00:00:07,120
because everyone needs to learn linux in
4
00:00:05,279 --> 00:00:08,639
episode one we learned a lot if you
5
00:00:07,120 --> 00:00:10,320
haven't seen it yet go check it out but
6
00:00:08,639 --> 00:00:12,480
that sucker just scratched the surface
7
00:00:10,320 --> 00:00:14,160
in episode two which is right now we're
8
00:00:12,480 --> 00:00:17,060
going deeper we're going crazy
9
00:00:14,160 --> 00:00:24,560
no time to waste let's start right now
10
00:00:17,060 --> 00:00:26,480
[Music]
11
00:00:24,560 --> 00:00:27,680
now just like episode one in the series
12
00:00:26,480 --> 00:00:30,640
you're getting a free
13
00:00:27,680 --> 00:00:31,679
linux lab to play with right now all
14
00:00:30,640 --> 00:00:33,520
thanks to my sponsor
15
00:00:31,679 --> 00:00:35,440
hack the box academy so if you haven't
16
00:00:33,520 --> 00:00:37,040
already signed up link below i walk you
17
00:00:35,440 --> 00:00:38,719
through it in episode 1
18
00:00:37,040 --> 00:00:40,399
so go check that out and before we get
19
00:00:38,719 --> 00:00:42,000
started have you hacked the youtube
20
00:00:40,399 --> 00:00:43,680
algorithm today
21
00:00:42,000 --> 00:00:45,520
like this video subscribe comment
22
00:00:43,680 --> 00:00:46,239
notification bell let's hack youtube
23
00:00:45,520 --> 00:00:49,600
today
24
00:00:46,239 --> 00:00:53,039
ethically of course anyways
25
00:00:49,600 --> 00:00:53,039
yeah let's get started
26
00:00:55,440 --> 00:00:58,480
all right before we get started we'll
27
00:00:56,640 --> 00:01:01,120
need two things first
28
00:00:58,480 --> 00:01:02,320
coffee check got it next we'll need our
29
00:01:01,120 --> 00:01:04,559
lab our linux lab
30
00:01:02,320 --> 00:01:06,080
free from hack the box academy go to get
31
00:01:04,559 --> 00:01:08,479
logged in right here and then we'll jump
32
00:01:06,080 --> 00:01:10,400
back into our linux fundamentals course
33
00:01:08,479 --> 00:01:12,240
and launch our phone box here at the
34
00:01:10,400 --> 00:01:12,799
very bottom go ahead and click on start
35
00:01:12,240 --> 00:01:14,640
instance
36
00:01:12,799 --> 00:01:16,240
boom now if you have no idea what i'm
37
00:01:14,640 --> 00:01:16,640
talking about here like what free linux
38
00:01:16,240 --> 00:01:18,320
will have
39
00:01:16,640 --> 00:01:20,560
go back to episode one i'll show you how
40
00:01:18,320 --> 00:01:22,240
to set this up anyways let's keep going
41
00:01:20,560 --> 00:01:24,320
and then we'll click interact to launch
42
00:01:22,240 --> 00:01:26,400
our linux box and the browser which is
43
00:01:24,320 --> 00:01:28,320
crazy still so cool to me anyways let's
44
00:01:26,400 --> 00:01:30,159
go now in episode one we covered that
45
00:01:28,320 --> 00:01:32,400
you don't experience linux like this
46
00:01:30,159 --> 00:01:34,159
no no no we're gonna launch our linux
47
00:01:32,400 --> 00:01:36,240
terminal right here go ahead and do that
48
00:01:34,159 --> 00:01:37,360
it's that green or yellow icon right
49
00:01:36,240 --> 00:01:40,720
there
50
00:01:37,360 --> 00:01:41,520
ah we're home yes now real quick who am
51
00:01:40,720 --> 00:01:43,439
i
52
00:01:41,520 --> 00:01:45,360
go ahead and type that in real quick who
53
00:01:43,439 --> 00:01:48,960
am i no spaces just type that in
54
00:01:45,360 --> 00:01:50,640
hit enter that's our first command today
55
00:01:48,960 --> 00:01:52,640
just a quick little fun command that
56
00:01:50,640 --> 00:01:54,479
tells us who we are
57
00:01:52,640 --> 00:01:56,799
who we are logged in as and i am user
58
00:01:54,479 --> 00:01:58,240
86527 who are you comment below just in
59
00:01:56,799 --> 00:01:59,920
case in linux you ever have an identity
60
00:01:58,240 --> 00:02:02,320
crisis you're like man who am i
61
00:01:59,920 --> 00:02:02,960
you can find out real quick moving on so
62
00:02:02,320 --> 00:02:04,399
last time
63
00:02:02,960 --> 00:02:06,719
in episode one we learned a few things
64
00:02:04,399 --> 00:02:08,160
like hey ls our list command will tell
65
00:02:06,719 --> 00:02:08,800
us all the stuff in our current working
66
00:02:08,160 --> 00:02:10,399
directory
67
00:02:08,800 --> 00:02:12,160
we also learn cd we can change
68
00:02:10,399 --> 00:02:12,879
directories to something else where
69
00:02:12,160 --> 00:02:16,400
we're not
70
00:02:12,879 --> 00:02:18,720
like cd desktop now we're in desktop if
71
00:02:16,400 --> 00:02:19,920
i type in pwd it'll also tell me where i
72
00:02:18,720 --> 00:02:21,120
am i'm in desktop
73
00:02:19,920 --> 00:02:23,360
because we just went there and we even
74
00:02:21,120 --> 00:02:25,040
saw that we type in cd space dot dot
75
00:02:23,360 --> 00:02:26,959
it'll take us back so now we're back
76
00:02:25,040 --> 00:02:31,200
where we started and but
77
00:02:26,959 --> 00:02:33,599
if we keep going cd dot dot
78
00:02:31,200 --> 00:02:34,959
cd dot dot we go back and back and back
79
00:02:33,599 --> 00:02:36,879
until we can't go back anymore
80
00:02:34,959 --> 00:02:38,239
which is where we're at right now
81
00:02:36,879 --> 00:02:41,360
forward slash
82
00:02:38,239 --> 00:02:41,920
the root if i type in pwd that's where
83
00:02:41,360 --> 00:02:43,440
we are
84
00:02:41,920 --> 00:02:44,319
the root of the file system that's where
85
00:02:43,440 --> 00:02:45,200
it all starts and that's where we're
86
00:02:44,319 --> 00:02:46,560
starting our video
87
00:02:45,200 --> 00:02:48,160
today and i'm going to clear my screen
88
00:02:46,560 --> 00:02:49,280
real quick just by typing in clear hey
89
00:02:48,160 --> 00:02:50,480
another command just type and clear
90
00:02:49,280 --> 00:02:52,319
it'll clear your terminal
91
00:02:50,480 --> 00:02:54,319
so it's nice and clean like a dry erase
92
00:02:52,319 --> 00:02:56,160
board clear now what's here
93
00:02:54,319 --> 00:02:57,680
what's at the root of the file system
94
00:02:56,160 --> 00:03:01,280
let's see go ahead and type in
95
00:02:57,680 --> 00:03:03,360
ls right now ls ooh a bunch of
96
00:03:01,280 --> 00:03:05,200
stuff let's find out what it is but
97
00:03:03,360 --> 00:03:06,800
before we do that i want to get one big
98
00:03:05,200 --> 00:03:08,000
idea across to you real quick those will
99
00:03:06,800 --> 00:03:08,560
help you understand things as we go
100
00:03:08,000 --> 00:03:10,560
forward
101
00:03:08,560 --> 00:03:11,680
everything and i mean everything and
102
00:03:10,560 --> 00:03:14,319
linux is a
103
00:03:11,680 --> 00:03:16,159
file literally everything like
104
00:03:14,319 --> 00:03:18,080
configuration like your network settings
105
00:03:16,159 --> 00:03:19,360
things like your ip address and all that
106
00:03:18,080 --> 00:03:21,599
interface stuff
107
00:03:19,360 --> 00:03:22,560
it's a file devices like your hard
108
00:03:21,599 --> 00:03:25,040
drives and your
109
00:03:22,560 --> 00:03:27,200
printers and your cd-roms all files they
110
00:03:25,040 --> 00:03:29,599
are represented in a file in linux
111
00:03:27,200 --> 00:03:31,040
now even more shocking and crazy the
112
00:03:29,599 --> 00:03:33,760
commands we use
113
00:03:31,040 --> 00:03:34,720
are also files ls and all the commands
114
00:03:33,760 --> 00:03:37,040
we just learned
115
00:03:34,720 --> 00:03:39,280
they're files what you don't believe me
116
00:03:37,040 --> 00:03:40,879
let me show you let's jump in there
117
00:03:39,280 --> 00:03:42,959
i'll show you where they live this first
118
00:03:40,879 --> 00:03:44,080
directory right here our bin directory i
119
00:03:42,959 --> 00:03:46,560
feel like i'm calling him
120
00:03:44,080 --> 00:03:48,959
ben hi ben let's jump in there real
121
00:03:46,560 --> 00:03:52,799
quick let's jump into ben
122
00:03:48,959 --> 00:03:55,599
that's weird anyways so we'll do cd
123
00:03:52,799 --> 00:03:56,400
bin to jump in there and we're there by
124
00:03:55,599 --> 00:03:58,640
the way ben
125
00:03:56,400 --> 00:04:00,799
stands for binaries you know computer
126
00:03:58,640 --> 00:04:03,760
speak and inside the bin folder
127
00:04:00,799 --> 00:04:04,959
or directory are the command binaries
128
00:04:03,760 --> 00:04:07,360
let's take a look inside
129
00:04:04,959 --> 00:04:08,239
let's type ls to list all the contents
130
00:04:07,360 --> 00:04:10,080
and whoa
131
00:04:08,239 --> 00:04:11,439
that was a lot and here are a lot of the
132
00:04:10,080 --> 00:04:13,680
commands you'll end up using
133
00:04:11,439 --> 00:04:15,760
in linux in fact within the bin folder
134
00:04:13,680 --> 00:04:17,440
are the essential command binaries
135
00:04:15,760 --> 00:04:19,759
so let's scroll up and let's let's find
136
00:04:17,440 --> 00:04:21,519
ls like it's here
137
00:04:19,759 --> 00:04:22,960
and the l's let me let me scroll up
138
00:04:21,519 --> 00:04:25,600
there ah there he is
139
00:04:22,960 --> 00:04:26,960
ls that sucker is a file the command you
140
00:04:25,600 --> 00:04:31,120
use to list files
141
00:04:26,960 --> 00:04:32,560
is itself a file right
142
00:04:31,120 --> 00:04:34,160
now if this is a file we should be able
143
00:04:32,560 --> 00:04:34,720
to bust it open and see what's inside
144
00:04:34,160 --> 00:04:37,520
right
145
00:04:34,720 --> 00:04:38,320
yes we can let's do that it's new
146
00:04:37,520 --> 00:04:42,080
command time
147
00:04:38,320 --> 00:04:43,280
so let me show you this command
148
00:04:42,080 --> 00:04:45,280
first i'm going to clear things out by
149
00:04:43,280 --> 00:04:48,560
tapping clear or i can actually do
150
00:04:45,280 --> 00:04:50,479
control l to clear
151
00:04:48,560 --> 00:04:51,919
yeah nice and clear this new command we
152
00:04:50,479 --> 00:04:55,120
have is
153
00:04:51,919 --> 00:04:58,800
cat cat that's it
154
00:04:55,120 --> 00:05:01,440
cat stands for con cat
155
00:04:58,800 --> 00:05:02,320
innate did i spell that right yeah i did
156
00:05:01,440 --> 00:05:04,000
yeah
157
00:05:02,320 --> 00:05:05,759
and like any cat this command will take
158
00:05:04,000 --> 00:05:06,880
a file and just throw it up on your
159
00:05:05,759 --> 00:05:10,320
terminal
160
00:05:06,880 --> 00:05:13,360
in the output let's try it let's cat ls
161
00:05:10,320 --> 00:05:13,360
cat ls
162
00:05:13,759 --> 00:05:18,800
that is a lot of spit up there
163
00:05:16,880 --> 00:05:20,800
now do you understand any of this
164
00:05:18,800 --> 00:05:23,039
because if you do you might be a robot
165
00:05:20,800 --> 00:05:24,000
where's my captcha for this course but
166
00:05:23,039 --> 00:05:25,840
anyways you should not
167
00:05:24,000 --> 00:05:27,280
understand this it's the command binary
168
00:05:25,840 --> 00:05:29,919
when you type in ls this is what it
169
00:05:27,280 --> 00:05:32,000
tells the computer to do
170
00:05:29,919 --> 00:05:33,520
now check this out to further illustrate
171
00:05:32,000 --> 00:05:35,360
that this is indeed a file
172
00:05:33,520 --> 00:05:37,199
i'm going to do something with it or to
173
00:05:35,360 --> 00:05:38,720
it i'm going to delete it
174
00:05:37,199 --> 00:05:40,639
you can delete files so let's delete
175
00:05:38,720 --> 00:05:41,039
this file now first you got to back it
176
00:05:40,639 --> 00:05:43,120
up so
177
00:05:41,039 --> 00:05:44,160
new command time here we go i'm going to
178
00:05:43,120 --> 00:05:46,720
clear things out
179
00:05:44,160 --> 00:05:48,560
i'm going to back up my ls command or
180
00:05:46,720 --> 00:05:51,759
rather i'm going to copy it
181
00:05:48,560 --> 00:05:52,639
so here we go new command cp cp stands
182
00:05:51,759 --> 00:05:54,560
for
183
00:05:52,639 --> 00:05:56,960
copy and that's pretty much what it
184
00:05:54,560 --> 00:05:58,560
means no further explanation needed so
185
00:05:56,960 --> 00:05:59,759
after cp we'll reference the file we
186
00:05:58,560 --> 00:06:02,720
want to copy so
187
00:05:59,759 --> 00:06:03,440
ls space and then the file we want to
188
00:06:02,720 --> 00:06:06,240
copy it to
189
00:06:03,440 --> 00:06:08,319
i'll name it i don't know network chuck
190
00:06:06,240 --> 00:06:10,319
you can name it whatever you want
191
00:06:08,319 --> 00:06:11,440
ah can't do it permission denied how do
192
00:06:10,319 --> 00:06:13,440
we fix that
193
00:06:11,440 --> 00:06:15,120
well sometimes in linux you have to say
194
00:06:13,440 --> 00:06:16,960
please i mean not really but
195
00:06:15,120 --> 00:06:18,720
kind of to give ourselves permission
196
00:06:16,960 --> 00:06:19,680
real quick for this one command we'll
197
00:06:18,720 --> 00:06:23,120
type in the
198
00:06:19,680 --> 00:06:26,560
sudo command before our command so sudo
199
00:06:23,120 --> 00:06:28,400
cp ls network check
200
00:06:26,560 --> 00:06:30,400
now we will end up covering what sudo
201
00:06:28,400 --> 00:06:30,880
means or su do but for right now just
202
00:06:30,400 --> 00:06:32,240
know
203
00:06:30,880 --> 00:06:34,240
we weren't allowed to use the copy
204
00:06:32,240 --> 00:06:35,120
command in this directory we didn't have
205
00:06:34,240 --> 00:06:37,520
the permissions
206
00:06:35,120 --> 00:06:39,840
but by using the sudo command we can
207
00:06:37,520 --> 00:06:40,960
pretend to be the root or the admin user
208
00:06:39,840 --> 00:06:43,759
for just that one command
209
00:06:40,960 --> 00:06:44,800
and we can run it so let's try it out
210
00:06:43,759 --> 00:06:46,800
totally worked
211
00:06:44,800 --> 00:06:48,000
so here's what we did we have the ls
212
00:06:46,800 --> 00:06:50,400
command still there
213
00:06:48,000 --> 00:06:51,440
but we also have a new command that's
214
00:06:50,400 --> 00:06:53,280
just network chuck
215
00:06:51,440 --> 00:06:55,199
that's because we copied the binary
216
00:06:53,280 --> 00:06:56,160
contents of ls to a new file named
217
00:06:55,199 --> 00:06:59,759
network chuck
218
00:06:56,160 --> 00:07:00,880
and if we try to use that command
219
00:06:59,759 --> 00:07:03,759
what do you think will happen let's try
220
00:07:00,880 --> 00:07:05,759
it out network chuck
221
00:07:03,759 --> 00:07:07,840
it's the ls command that's that's kind
222
00:07:05,759 --> 00:07:09,599
of cool right anyways
223
00:07:07,840 --> 00:07:12,160
let's delete the ls command we can do
224
00:07:09,599 --> 00:07:16,639
that let me clear my screen once more
225
00:07:12,160 --> 00:07:18,319
new command time the command will be r m
226
00:07:16,639 --> 00:07:19,840
very simple two letter commands right
227
00:07:18,319 --> 00:07:22,479
now rm stands for
228
00:07:19,840 --> 00:07:24,400
remove and much like the copy command no
229
00:07:22,479 --> 00:07:28,160
explanation necessary it removes crap
230
00:07:24,400 --> 00:07:29,919
it removes stuff so i'll say remove ls
231
00:07:28,160 --> 00:07:31,520
now as you may imagine we'll also need
232
00:07:29,919 --> 00:07:32,800
pseudo permissions to remove this so
233
00:07:31,520 --> 00:07:34,720
i'll go to the beginning of my command
234
00:07:32,800 --> 00:07:37,520
and type in sudo
235
00:07:34,720 --> 00:07:39,360
so sudo rmls and it's going to go away
236
00:07:37,520 --> 00:07:42,639
say bye
237
00:07:39,360 --> 00:07:44,160
it's gone so now what do you think will
238
00:07:42,639 --> 00:07:47,280
happen if we type in ls
239
00:07:44,160 --> 00:07:49,599
let's try it ls
240
00:07:47,280 --> 00:07:53,120
nope it's gone but not a big deal like
241
00:07:49,599 --> 00:07:53,120
we still have network chuck don't we
242
00:07:55,120 --> 00:07:58,879
it still does the same thing so we're
243
00:07:56,400 --> 00:08:00,319
good but for real to return it back to
244
00:07:58,879 --> 00:08:05,039
normal all we got to do is
245
00:08:00,319 --> 00:08:06,800
sudo copy once more just cp right
246
00:08:05,039 --> 00:08:09,680
we want to copy the contents of network
247
00:08:06,800 --> 00:08:12,879
chuck to a new file named
248
00:08:09,680 --> 00:08:14,879
ls so now if we type in ls once more
249
00:08:12,879 --> 00:08:16,080
ah we're back we're good now let's talk
250
00:08:14,879 --> 00:08:18,400
about ben again
251
00:08:16,080 --> 00:08:19,759
ben he's got all the essential command
252
00:08:18,400 --> 00:08:22,319
binaries like we talked about
253
00:08:19,759 --> 00:08:23,039
things like the commands we just learned
254
00:08:22,319 --> 00:08:26,400
cp
255
00:08:23,039 --> 00:08:30,160
copy rm remove and even cat
256
00:08:26,400 --> 00:08:33,839
there he is which also means we can
257
00:08:30,160 --> 00:08:36,719
cat cat let's try it out cat
258
00:08:33,839 --> 00:08:39,039
cat and we just catted cat anyways let's
259
00:08:36,719 --> 00:08:40,640
move on so i'm gonna cd dot dot or
260
00:08:39,039 --> 00:08:43,279
cd forward slash to get back to our
261
00:08:40,640 --> 00:08:44,959
route let's clear things out once more
262
00:08:43,279 --> 00:08:46,560
and let's list the contents once more of
263
00:08:44,959 --> 00:08:48,399
root so we talked about ben
264
00:08:46,560 --> 00:08:49,680
the the bend directory he's awesome but
265
00:08:48,399 --> 00:08:50,399
there's also another one over here
266
00:08:49,680 --> 00:08:53,600
called
267
00:08:50,399 --> 00:08:56,000
s ben or i like to refer to it as
268
00:08:53,600 --> 00:08:57,839
super ben ben with a cape on now super
269
00:08:56,000 --> 00:09:00,240
ben is just like ben but he's
270
00:08:57,839 --> 00:09:01,760
a bit more special you see super ben has
271
00:09:00,240 --> 00:09:04,800
special commands that only
272
00:09:01,760 --> 00:09:05,600
administrators would use to administer
273
00:09:04,800 --> 00:09:06,959
the system
274
00:09:05,600 --> 00:09:08,959
let me show you let's jump into super
275
00:09:06,959 --> 00:09:11,519
bent so cd s bin
276
00:09:08,959 --> 00:09:13,120
and if we ls inside super bin or list as
277
00:09:11,519 --> 00:09:14,560
contents we'll see some cool commands
278
00:09:13,120 --> 00:09:15,440
some top secret commands that only
279
00:09:14,560 --> 00:09:16,959
admins can use
280
00:09:15,440 --> 00:09:18,560
we'll take a look at one and actually
281
00:09:16,959 --> 00:09:18,880
use it real quick let me score the top
282
00:09:18,560 --> 00:09:21,600
here
283
00:09:18,880 --> 00:09:22,959
ah here we go add user what do you think
284
00:09:21,600 --> 00:09:24,880
that does
285
00:09:22,959 --> 00:09:26,320
wild guess it's going to add ourselves a
286
00:09:24,880 --> 00:09:27,440
user so let's do that real quick i'm
287
00:09:26,320 --> 00:09:28,959
going to clear my screen
288
00:09:27,440 --> 00:09:30,560
and we'll do sudo because this is a
289
00:09:28,959 --> 00:09:34,320
special command we'll need please
290
00:09:30,560 --> 00:09:35,760
please add user and then the username
291
00:09:34,320 --> 00:09:37,120
now this is new command time i forgot to
292
00:09:35,760 --> 00:09:37,920
say it new command time i'm going to
293
00:09:37,120 --> 00:09:39,440
create
294
00:09:37,920 --> 00:09:41,680
super ben i feel like he should have a
295
00:09:39,440 --> 00:09:42,399
presence right now so sudo add user
296
00:09:41,680 --> 00:09:44,160
super bin
297
00:09:42,399 --> 00:09:45,760
and it's creating we'll give a password
298
00:09:44,160 --> 00:09:48,640
to super bin
299
00:09:45,760 --> 00:09:51,120
give him a full name super bin skip the
300
00:09:48,640 --> 00:09:53,680
rest of the stuff
301
00:09:51,120 --> 00:09:55,200
super ben is alive he's here we added a
302
00:09:53,680 --> 00:09:56,959
user but anyways that's what you see in
303
00:09:55,200 --> 00:09:59,120
sbin super bing commands
304
00:09:56,959 --> 00:10:01,680
let's get back out of there cd dot dot
305
00:09:59,120 --> 00:10:02,959
and clear my screen once more
306
00:10:01,680 --> 00:10:04,480
let's do ls and see what we're working
307
00:10:02,959 --> 00:10:05,600
with again now we're still going to talk
308
00:10:04,480 --> 00:10:07,760
about commands for a bit
309
00:10:05,600 --> 00:10:08,800
we're not quite done ben had our
310
00:10:07,760 --> 00:10:10,720
essential commands
311
00:10:08,800 --> 00:10:11,920
super bin had our super essential
312
00:10:10,720 --> 00:10:12,560
commands but now we're going to jump
313
00:10:11,920 --> 00:10:15,120
into our
314
00:10:12,560 --> 00:10:17,200
user directory let's jump in there real
315
00:10:15,120 --> 00:10:20,399
quick so cd
316
00:10:17,200 --> 00:10:21,760
user usr type in ls while we're there
317
00:10:20,399 --> 00:10:23,519
and notice something kind of strange it
318
00:10:21,760 --> 00:10:25,440
might throw you off inside the usr
319
00:10:23,519 --> 00:10:28,640
directory or the user directory
320
00:10:25,440 --> 00:10:30,880
we also have a ben and an s bin
321
00:10:28,640 --> 00:10:32,480
huh what's going on here something's up
322
00:10:30,880 --> 00:10:35,120
let's take a look inside so
323
00:10:32,480 --> 00:10:36,079
cd into ben but inside the user
324
00:10:35,120 --> 00:10:38,959
directory
325
00:10:36,079 --> 00:10:38,959
let's ls that
326
00:10:39,200 --> 00:10:42,880
looks like a lot of the same things
327
00:10:40,480 --> 00:10:45,279
doesn't it like is there an ls here
328
00:10:42,880 --> 00:10:46,000
yep so same commands here let's jump
329
00:10:45,279 --> 00:10:49,120
back for a second
330
00:10:46,000 --> 00:10:50,480
cd dot dot and then jump into s ben here
331
00:10:49,120 --> 00:10:52,800
inside the user directory
332
00:10:50,480 --> 00:10:54,000
let's ls that yup seems to have the same
333
00:10:52,800 --> 00:10:55,760
commands here too
334
00:10:54,000 --> 00:10:57,200
what's going on it seems like we have
335
00:10:55,760 --> 00:10:59,279
some imposters here like
336
00:10:57,200 --> 00:11:01,519
which one is the real one ben and root
337
00:10:59,279 --> 00:11:03,519
or been in the user directory
338
00:11:01,519 --> 00:11:04,640
the answer is both they're both real
339
00:11:03,519 --> 00:11:06,800
there's actually a pretty interesting
340
00:11:04,640 --> 00:11:07,839
history as to why we have two locations
341
00:11:06,800 --> 00:11:09,760
i'm not going to talk about it here but
342
00:11:07,839 --> 00:11:11,600
it all comes down to hard drive space
343
00:11:09,760 --> 00:11:13,360
look it up but essentially the ben and
344
00:11:11,600 --> 00:11:14,000
the super bin directories in the user
345
00:11:13,360 --> 00:11:16,640
directory
346
00:11:14,000 --> 00:11:18,320
are the same as the ben and s bin in the
347
00:11:16,640 --> 00:11:19,680
root directory now ben and s ben in the
348
00:11:18,320 --> 00:11:22,079
user directory will typically have
349
00:11:19,680 --> 00:11:23,839
more commands there but you will see a
350
00:11:22,079 --> 00:11:26,240
ton of overlap here so that begs the
351
00:11:23,839 --> 00:11:28,560
question when we use the ls command
352
00:11:26,240 --> 00:11:29,839
are we using the command stored in bin
353
00:11:28,560 --> 00:11:31,360
or in user
354
00:11:29,839 --> 00:11:34,640
bin we can actually find out you want to
355
00:11:31,360 --> 00:11:35,839
try it let's try it out new command time
356
00:11:34,640 --> 00:11:38,000
go ahead and clear your screen with me
357
00:11:35,839 --> 00:11:39,760
here we're going to type in the command
358
00:11:38,000 --> 00:11:42,160
which it's going to help us figure out
359
00:11:39,760 --> 00:11:44,079
which is it is it in bin
360
00:11:42,160 --> 00:11:45,440
or is it in user bin so type in which
361
00:11:44,079 --> 00:11:48,720
and then right after that
362
00:11:45,440 --> 00:11:53,200
ls hit enter ah so it's the ls
363
00:11:48,720 --> 00:11:54,880
and user bin if we which cat
364
00:11:53,200 --> 00:11:56,880
it's also in user forward slash ben
365
00:11:54,880 --> 00:11:58,079
which if you didn't catch on what which
366
00:11:56,880 --> 00:11:59,519
is doing
367
00:11:58,079 --> 00:12:01,040
i feel like i'm saying which too much
368
00:11:59,519 --> 00:12:02,399
you can use which to find out where your
369
00:12:01,040 --> 00:12:03,920
command binaries live
370
00:12:02,399 --> 00:12:05,519
so i can actually which that command i
371
00:12:03,920 --> 00:12:07,839
made earlier which
372
00:12:05,519 --> 00:12:09,760
network chuck so that's pretty cool and
373
00:12:07,839 --> 00:12:11,680
that's extremely handy so anyways let's
374
00:12:09,760 --> 00:12:14,880
um get back to our user directory
375
00:12:11,680 --> 00:12:16,320
cd dot dot let's ls once more
376
00:12:14,880 --> 00:12:18,320
so again here in our user directory we
377
00:12:16,320 --> 00:12:20,320
have ben and super bin
378
00:12:18,320 --> 00:12:21,839
carbon copies but a bit more power we
379
00:12:20,320 --> 00:12:22,560
also have a local directory which you
380
00:12:21,839 --> 00:12:24,800
can hardly see
381
00:12:22,560 --> 00:12:26,480
let me back up there our local directory
382
00:12:24,800 --> 00:12:28,320
which similar to ben and super bin will
383
00:12:26,480 --> 00:12:29,279
store command binaries but it's here
384
00:12:28,320 --> 00:12:31,040
that you'll want to store the command
385
00:12:29,279 --> 00:12:32,880
binaries that you might create
386
00:12:31,040 --> 00:12:34,639
anyways let's move on the user directory
387
00:12:32,880 --> 00:12:36,480
also has some fun stuff like libraries
388
00:12:34,639 --> 00:12:39,120
that the command binaries will share
389
00:12:36,480 --> 00:12:39,519
and apparently it has games that's fun
390
00:12:39,120 --> 00:12:40,720
so
391
00:12:39,519 --> 00:12:43,200
we don't use a directory let's get out
392
00:12:40,720 --> 00:12:43,600
of there cd dot dot let's ls once more
393
00:12:43,200 --> 00:12:46,160
to see
394
00:12:43,600 --> 00:12:47,279
our root location here now real quick
395
00:12:46,160 --> 00:12:49,040
speed route
396
00:12:47,279 --> 00:12:51,040
boot what is that files your system
397
00:12:49,040 --> 00:12:53,600
needs to boot boot files
398
00:12:51,040 --> 00:12:54,480
self-explanatory let's move on var will
399
00:12:53,600 --> 00:12:56,720
have things like
400
00:12:54,480 --> 00:12:58,160
log files and also web application
401
00:12:56,720 --> 00:12:58,720
related files we'll talk more about that
402
00:12:58,160 --> 00:13:01,920
later
403
00:12:58,720 --> 00:13:03,839
temp or tmp temporary files
404
00:13:01,920 --> 00:13:06,320
files that go away after a system reboot
405
00:13:03,839 --> 00:13:08,320
or something another lib directory
406
00:13:06,320 --> 00:13:09,920
more shared library files specifically
407
00:13:08,320 --> 00:13:12,240
things your system needs to boot
408
00:13:09,920 --> 00:13:13,839
okay speed round done some more stuff
409
00:13:12,240 --> 00:13:14,959
some more key directories here in the
410
00:13:13,839 --> 00:13:17,440
route
411
00:13:14,959 --> 00:13:18,480
first home home is where you live home
412
00:13:17,440 --> 00:13:20,639
is where we
413
00:13:18,480 --> 00:13:22,320
live in fact it's where every user lives
414
00:13:20,639 --> 00:13:25,519
on your system let's take a look inside
415
00:13:22,320 --> 00:13:28,320
cd home now what's ls there real quick
416
00:13:25,519 --> 00:13:28,959
aha two homes one is our home and then
417
00:13:28,320 --> 00:13:30,800
one hey
418
00:13:28,959 --> 00:13:34,480
super bend has a home too if we see the
419
00:13:30,800 --> 00:13:37,279
it's a super bin
420
00:13:34,480 --> 00:13:37,760
and ls his stuff ah there's his house
421
00:13:37,279 --> 00:13:38,959
all right
422
00:13:37,760 --> 00:13:40,800
we're on welcome here let's get out of
423
00:13:38,959 --> 00:13:43,040
here let's get back to our route now
424
00:13:40,800 --> 00:13:44,800
every linux system has a root user
425
00:13:43,040 --> 00:13:46,399
but we didn't see a home for the route
426
00:13:44,800 --> 00:13:48,000
where does he live because he wasn't
427
00:13:46,399 --> 00:13:50,000
in this home but you may have noticed
428
00:13:48,000 --> 00:13:52,399
that he is over here
429
00:13:50,000 --> 00:13:53,199
all by himself he's special he lives
430
00:13:52,399 --> 00:13:54,800
somewhere else
431
00:13:53,199 --> 00:13:56,639
where people can't bother him he's kind
432
00:13:54,800 --> 00:13:57,839
of a recluse or a recluse i don't know
433
00:13:56,639 --> 00:13:59,279
how to emphasize that
434
00:13:57,839 --> 00:14:00,959
we can list the contents of root let's
435
00:13:59,279 --> 00:14:02,399
do a pseudo because we'll need his
436
00:14:00,959 --> 00:14:04,880
special permissions to look inside his
437
00:14:02,399 --> 00:14:06,639
house sudo ls
438
00:14:04,880 --> 00:14:08,079
root and we're looking inside the root
439
00:14:06,639 --> 00:14:09,760
directory
440
00:14:08,079 --> 00:14:12,160
there's all his stuff anyways let's keep
441
00:14:09,760 --> 00:14:14,959
moving now earlier i mentioned that
442
00:14:12,160 --> 00:14:16,800
even devices in our system are files
443
00:14:14,959 --> 00:14:17,519
hard drives printers cd-roms you want to
444
00:14:16,800 --> 00:14:20,399
see them
445
00:14:17,519 --> 00:14:21,839
they're right here in the dev directory
446
00:14:20,399 --> 00:14:26,000
dev stands for devices
447
00:14:21,839 --> 00:14:28,639
let's go take a look well cd dev
448
00:14:26,000 --> 00:14:30,240
let's ls that sucker oh a lot of weird
449
00:14:28,639 --> 00:14:32,000
stuff going on
450
00:14:30,240 --> 00:14:33,600
now we could spend all day here but
451
00:14:32,000 --> 00:14:34,560
we're not going to we're going to look
452
00:14:33,600 --> 00:14:38,320
at one thing
453
00:14:34,560 --> 00:14:40,800
vda and vda1 those right now are our
454
00:14:38,320 --> 00:14:42,240
hard drives they stand for virtual disks
455
00:14:40,800 --> 00:14:43,120
on other linux systems you might see
456
00:14:42,240 --> 00:14:46,800
this listed as
457
00:14:43,120 --> 00:14:48,480
sda or sda1 and that's our hard drive
458
00:14:46,800 --> 00:14:50,560
that's the disk it's a file
459
00:14:48,480 --> 00:14:51,760
which means we can cap that sucker so
460
00:14:50,560 --> 00:14:54,399
let's do that now
461
00:14:51,760 --> 00:14:55,440
it's this is gonna be a little rough it
462
00:14:54,399 --> 00:14:56,639
might scare you
463
00:14:55,440 --> 00:14:58,079
and i'll show you how to stop it here in
464
00:14:56,639 --> 00:14:58,720
a second but we're going to do this
465
00:14:58,079 --> 00:15:02,079
we're going to
466
00:14:58,720 --> 00:15:04,720
cat our drive
467
00:15:02,079 --> 00:15:06,079
cat vda i believe we will need pseudo
468
00:15:04,720 --> 00:15:08,480
permission so i'll put a pseudo here at
469
00:15:06,079 --> 00:15:08,480
the beginning
470
00:15:09,440 --> 00:15:13,839
ready for this it's going to blow up
471
00:15:14,320 --> 00:15:18,639
and it's gonna keep going hurry hit
472
00:15:15,760 --> 00:15:21,920
control c and it stops
473
00:15:18,639 --> 00:15:23,360
yeah whoo but yeah that's all the binary
474
00:15:21,920 --> 00:15:24,240
and gobbledygook and all the stuff that
475
00:15:23,360 --> 00:15:26,560
your hard drive
476
00:15:24,240 --> 00:15:27,360
is it's a stinking file which is really
477
00:15:26,560 --> 00:15:29,120
cool and really
478
00:15:27,360 --> 00:15:30,639
really weird you know but anyways the
479
00:15:29,120 --> 00:15:33,440
dev directory
480
00:15:30,639 --> 00:15:34,560
is where devices live now i also
481
00:15:33,440 --> 00:15:36,880
mentioned that the settings of your
482
00:15:34,560 --> 00:15:38,480
linux server or your linux computer
483
00:15:36,880 --> 00:15:40,079
are files things like your network
484
00:15:38,480 --> 00:15:41,920
settings are stored inside
485
00:15:40,079 --> 00:15:44,000
a file you want to see it let's go see
486
00:15:41,920 --> 00:15:47,040
it real quick these things are stored in
487
00:15:44,000 --> 00:15:48,880
the etc file which stands for etc
488
00:15:47,040 --> 00:15:50,800
officially i think so you might hear it
489
00:15:48,880 --> 00:15:52,959
referred to as the etc file
490
00:15:50,800 --> 00:15:54,079
or directory but people mainly call it
491
00:15:52,959 --> 00:15:55,759
in the linux world
492
00:15:54,079 --> 00:15:57,839
the etsy file which was here first
493
00:15:55,759 --> 00:15:59,440
before etsy.com
494
00:15:57,839 --> 00:16:00,639
so they stole the idea but let's jump in
495
00:15:59,440 --> 00:16:03,040
there real quick let's jump into our
496
00:16:00,639 --> 00:16:04,160
etsy file so we'll see the etc
497
00:16:03,040 --> 00:16:05,839
you'll go here a lot because
498
00:16:04,160 --> 00:16:06,160
configuration files of your system are
499
00:16:05,839 --> 00:16:07,600
here
500
00:16:06,160 --> 00:16:09,279
as well as some applications they can
501
00:16:07,600 --> 00:16:12,800
throw some stuff in there too
502
00:16:09,279 --> 00:16:14,560
if we lsd etc directory a ton of stuff
503
00:16:12,800 --> 00:16:16,320
almost too much stuff but let's focus on
504
00:16:14,560 --> 00:16:18,079
one set of configurations let's focus on
505
00:16:16,320 --> 00:16:19,199
networking so right here we've got our
506
00:16:18,079 --> 00:16:22,399
network directory
507
00:16:19,199 --> 00:16:24,800
let's jump in there cd network
508
00:16:22,399 --> 00:16:26,079
let's lsd network directory and we got a
509
00:16:24,800 --> 00:16:26,720
few things going on here but the thing i
510
00:16:26,079 --> 00:16:29,040
want you to see
511
00:16:26,720 --> 00:16:31,040
is the interfaces file let's take a look
512
00:16:29,040 --> 00:16:34,399
at that let's cap that sucker
513
00:16:31,040 --> 00:16:37,839
cat interfaces
514
00:16:34,399 --> 00:16:41,279
ah we need to say please sudo
515
00:16:37,839 --> 00:16:42,959
cat interfaces there we go
516
00:16:41,279 --> 00:16:44,880
here in a file are your network
517
00:16:42,959 --> 00:16:45,519
interfaces and they're assigned ip
518
00:16:44,880 --> 00:16:46,959
addresses
519
00:16:45,519 --> 00:16:48,480
this is where they're configured pretty
520
00:16:46,959 --> 00:16:50,000
cool and if you wanted to change your
521
00:16:48,480 --> 00:16:52,000
network settings you would often go
522
00:16:50,000 --> 00:16:53,440
into this file and just change it here
523
00:16:52,000 --> 00:16:55,199
now things do work differently on some
524
00:16:53,440 --> 00:16:56,480
linux systems nowadays but this was a
525
00:16:55,199 --> 00:16:58,160
common way to do it and
526
00:16:56,480 --> 00:17:00,320
is still the common way to do on some
527
00:16:58,160 --> 00:17:02,079
systems now we're almost done i know
528
00:17:00,320 --> 00:17:03,839
it's been a lot but i got to cover this
529
00:17:02,079 --> 00:17:05,520
i've got i got to show you this stuff
530
00:17:03,839 --> 00:17:06,640
let's get back to our route cd forward
531
00:17:05,520 --> 00:17:09,039
slash
532
00:17:06,640 --> 00:17:09,839
clear the screen two more places i want
533
00:17:09,039 --> 00:17:12,559
to talk about
534
00:17:09,839 --> 00:17:13,039
let's ls the route so last two here we
535
00:17:12,559 --> 00:17:15,360
go
536
00:17:13,039 --> 00:17:17,360
here we have the mnt directory and the
537
00:17:15,360 --> 00:17:18,160
media directory they both do the same
538
00:17:17,360 --> 00:17:20,480
thing
539
00:17:18,160 --> 00:17:22,559
they mount drives if you plug in a usb
540
00:17:20,480 --> 00:17:24,400
flash drive into your linux box here
541
00:17:22,559 --> 00:17:26,000
it will automatically and auto magically
542
00:17:24,400 --> 00:17:28,079
be mounted to the
543
00:17:26,000 --> 00:17:30,480
media directory as a file because
544
00:17:28,079 --> 00:17:32,559
everything's a stinking file remember
545
00:17:30,480 --> 00:17:34,480
so media is mainly for your system
546
00:17:32,559 --> 00:17:36,880
mounting things automatically for you
547
00:17:34,480 --> 00:17:38,559
whereas the mnt directory it also has
548
00:17:36,880 --> 00:17:39,840
drives mounted to it but it drives you
549
00:17:38,559 --> 00:17:41,600
might mount
550
00:17:39,840 --> 00:17:43,360
manually you would actually use commands
551
00:17:41,600 --> 00:17:45,280
to mount a drive and again that would be
552
00:17:43,360 --> 00:17:47,280
represented as a file in the mnt
553
00:17:45,280 --> 00:17:49,440
directory now i think we covered most of
554
00:17:47,280 --> 00:17:51,360
it like almost all of it
555
00:17:49,440 --> 00:17:53,360
if you're still curious about any of the
556
00:17:51,360 --> 00:17:54,960
remaining ones
557
00:17:53,360 --> 00:17:56,559
let's ls that real quick there are a few
558
00:17:54,960 --> 00:17:57,679
we didn't talk about and maybe a few you
559
00:17:56,559 --> 00:18:00,160
want to review
560
00:17:57,679 --> 00:18:01,039
go check out the hack the box academy
561
00:18:00,160 --> 00:18:03,520
right up here
562
00:18:01,039 --> 00:18:04,160
they do go over most of the ones we
563
00:18:03,520 --> 00:18:07,120
mentioned here
564
00:18:04,160 --> 00:18:10,880
and some we didn't so refer to that wow
565
00:18:07,120 --> 00:18:13,520
we covered so much in this video
566
00:18:10,880 --> 00:18:15,440
oh you need coffee for this but it was
567
00:18:13,520 --> 00:18:17,520
awesome right so we like we saw
568
00:18:15,440 --> 00:18:18,799
that everything literally everything in
569
00:18:17,520 --> 00:18:20,080
linux is a file
570
00:18:18,799 --> 00:18:21,919
and we jumped around the different
571
00:18:20,080 --> 00:18:23,440
directories and looked at everything
572
00:18:21,919 --> 00:18:25,919
from devices to commands
573
00:18:23,440 --> 00:18:27,600
to configuration files and we covered
574
00:18:25,919 --> 00:18:29,360
what the main directories actually are
575
00:18:27,600 --> 00:18:30,080
for and that's key in learning linux
576
00:18:29,360 --> 00:18:32,480
because when you
577
00:18:30,080 --> 00:18:33,919
are doing stuff in linux when you're
578
00:18:32,480 --> 00:18:34,480
messing with applications or configuring
579
00:18:33,919 --> 00:18:35,919
things or
580
00:18:34,480 --> 00:18:37,760
hacking it's important to know where
581
00:18:35,919 --> 00:18:39,200
stuff is and where stuff should go
582
00:18:37,760 --> 00:18:41,520
and then while we were jumping around
583
00:18:39,200 --> 00:18:44,160
and exploring our linux file system
584
00:18:41,520 --> 00:18:45,280
which officially is called the fhs how
585
00:18:44,160 --> 00:18:47,600
it's arranged the
586
00:18:45,280 --> 00:18:49,600
file system hierarchy while doing that
587
00:18:47,600 --> 00:18:52,720
we learned a bunch of new commands
588
00:18:49,600 --> 00:18:56,799
things like who am i cp or copy
589
00:18:52,720 --> 00:18:58,559
rm or remove add user which cat
590
00:18:56,799 --> 00:18:59,919
so we did a lot today so here's my
591
00:18:58,559 --> 00:19:02,880
homework for you
592
00:18:59,919 --> 00:19:03,679
i want you to first make flash cards of
593
00:19:02,880 --> 00:19:05,039
all these commands
594
00:19:03,679 --> 00:19:07,039
i want you to commit these suckers to
595
00:19:05,039 --> 00:19:07,919
memory second i want you to practice
596
00:19:07,039 --> 00:19:09,840
using these
597
00:19:07,919 --> 00:19:11,600
jump around if you forget who you are
598
00:19:09,840 --> 00:19:13,200
type in who am i
599
00:19:11,600 --> 00:19:14,080
copy things remove things be careful
600
00:19:13,200 --> 00:19:15,440
though although if you're using this
601
00:19:14,080 --> 00:19:18,400
hack the box lab you can just
602
00:19:15,440 --> 00:19:20,080
restart it it's fine witch cat which cat
603
00:19:18,400 --> 00:19:22,000
all kinds of stuff cat cat the more you
604
00:19:20,080 --> 00:19:23,760
practice the faster you'll learn linux
605
00:19:22,000 --> 00:19:25,360
the better an engineer you'll become now
606
00:19:23,760 --> 00:19:26,480
that's your homework but i also have a
607
00:19:25,360 --> 00:19:27,840
challenge for you i always have a
608
00:19:26,480 --> 00:19:29,440
challenge let's see what you got
609
00:19:27,840 --> 00:19:31,360
and i'll actually have that quiz linked
610
00:19:29,440 --> 00:19:32,720
below the first one to get all the
611
00:19:31,360 --> 00:19:34,240
answers right will win a
612
00:19:32,720 --> 00:19:36,240
gift card to network chuck coffee so you
613
00:19:34,240 --> 00:19:38,559
can grab yourself some coffee or
614
00:19:36,240 --> 00:19:40,240
a shirt or a mug or whatever hurry up
615
00:19:38,559 --> 00:19:41,840
well guys that's about it
616
00:19:40,240 --> 00:19:44,000
huge shout out again to the sponsor of
617
00:19:41,840 --> 00:19:45,840
the series hack the box academy this is
618
00:19:44,000 --> 00:19:47,360
the structured learning platform for
619
00:19:45,840 --> 00:19:48,480
hack the box it's where you want to come
620
00:19:47,360 --> 00:19:50,400
to learn how to hack
621
00:19:48,480 --> 00:19:52,000
and also it's what you can use right now
622
00:19:50,400 --> 00:19:53,440
as a free lab as you go through
623
00:19:52,000 --> 00:19:55,120
this course so if you haven't already
624
00:19:53,440 --> 00:19:56,320
signed up i mean what are you doing you
625
00:19:55,120 --> 00:19:58,799
can practice for free
626
00:19:56,320 --> 00:20:00,240
right now right now and of course don't
627
00:19:58,799 --> 00:20:01,760
forget to hack the youtube algorithm
628
00:20:00,240 --> 00:20:03,919
today hit that like button subscribe
629
00:20:01,760 --> 00:20:06,000
notification bell comment all that stuff
630
00:20:03,919 --> 00:20:08,159
let's hack youtube today ethically of
631
00:20:06,000 --> 00:20:10,400
course and yeah that's about all i have
632
00:20:08,159 --> 00:20:11,200
this was episode two of my linux for
633
00:20:10,400 --> 00:20:15,919
hackers and
634
00:20:11,200 --> 00:20:15,919
everyone course i'll catch you guys next
635
00:20:18,840 --> 00:20:21,840
time
636
00:20:22,410 --> 00:20:34,720
[Music]
637
00:20:32,640 --> 00:20:34,720
you
42203
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.