the Linux File System explained in 1,233 seconds // Linux for Hackers // EP 2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to linux for hackers and everyone because everyone needs to learn linux in episode one we learned a lot if you haven't seen it yet go check it out but that sucker just scratched the surface in episode two which is right now we're going deeper we're going crazy no time to waste let's start right now [Music] now just like episode one in the series you're getting a free linux lab to play with right now all thanks to my sponsor hack the box academy so if you haven't already signed up link below i walk you through it in episode 1 so go check that out and before we get started have you hacked the youtube algorithm today like this video subscribe comment notification bell let's hack youtube today ethically of course anyways yeah let's get started all right before we get started we'll need two things first coffee check got it next we'll need our lab our linux lab free from hack the box academy go to get logged in right here and then we'll jump back into our linux fundamentals course and launch our phone box here at the very bottom go ahead and click on start instance boom now if you have no idea what i'm talking about here like what free linux will have go back to episode one i'll show you how to set this up anyways let's keep going and then we'll click interact to launch our linux box and the browser which is crazy still so cool to me anyways let's go now in episode one we covered that you don't experience linux like this no no no we're gonna launch our linux terminal right here go ahead and do that it's that green or yellow icon right there ah we're home yes now real quick who am i go ahead and type that in real quick who am i no spaces just type that in hit enter that's our first command today just a quick little fun command that tells us who we are who we are logged in as and i am user 86527 who are you comment below just in case in linux you ever have an identity crisis you're like man who am i you can find out real quick moving on so last time in episode one we learned a few things like hey ls our list command will tell us all the stuff in our current working directory we also learn cd we can change directories to something else where we're not like cd desktop now we're in desktop if i type in pwd it'll also tell me where i am i'm in desktop because we just went there and we even saw that we type in cd space dot dot it'll take us back so now we're back where we started and but if we keep going cd dot dot cd dot dot we go back and back and back until we can't go back anymore which is where we're at right now forward slash the root if i type in pwd that's where we are the root of the file system that's where it all starts and that's where we're starting our video today and i'm going to clear my screen real quick just by typing in clear hey another command just type and clear it'll clear your terminal so it's nice and clean like a dry erase board clear now what's here what's at the root of the file system let's see go ahead and type in ls right now ls ooh a bunch of stuff let's find out what it is but before we do that i want to get one big idea across to you real quick those will help you understand things as we go forward everything and i mean everything and linux is a file literally everything like configuration like your network settings things like your ip address and all that interface stuff it's a file devices like your hard drives and your printers and your cd-roms all files they are represented in a file in linux now even more shocking and crazy the commands we use are also files ls and all the commands we just learned they're files what you don't believe me let me show you let's jump in there i'll show you where they live this first directory right here our bin directory i feel like i'm calling him ben hi ben let's jump in there real quick let's jump into ben that's weird anyways so we'll do cd bin to jump in there and we're there by the way ben stands for binaries you know computer speak and inside the bin folder or directory are the command binaries let's take a look inside let's type ls to list all the contents and whoa that was a lot and here are a lot of the commands you'll end up using in linux in fact within the bin folder are the essential command binaries so let's scroll up and let's let's find ls like it's here and the l's let me let me scroll up there ah there he is ls that sucker is a file the command you use to list files is itself a file right now if this is a file we should be able to bust it open and see what's inside right yes we can let's do that it's new command time so let me show you this command first i'm going to clear things out by tapping clear or i can actually do control l to clear yeah nice and clear this new command we have is cat cat that's it cat stands for con cat innate did i spell that right yeah i did yeah and like any cat this command will take a file and just throw it up on your terminal in the output let's try it let's cat ls cat ls that is a lot of spit up there now do you understand any of this because if you do you might be a robot where's my captcha for this course but anyways you should not understand this it's the command binary when you type in ls this is what it tells the computer to do now check this out to further illustrate that this is indeed a file i'm going to do something with it or to it i'm going to delete it you can delete files so let's delete this file now first you got to back it up so new command time here we go i'm going to clear things out i'm going to back up my ls command or rather i'm going to copy it so here we go new command cp cp stands for copy and that's pretty much what it means no further explanation needed so after cp we'll reference the file we want to copy so ls space and then the file we want to copy it to i'll name it i don't know network chuck you can name it whatever you want ah can't do it permission denied how do we fix that well sometimes in linux you have to say please i mean not really but kind of to give ourselves permission real quick for this one command we'll type in the sudo command before our command so sudo cp ls network check now we will end up covering what sudo means or su do but for right now just know we weren't allowed to use the copy command in this directory we didn't have the permissions but by using the sudo command we can pretend to be the root or the admin user for just that one command and we can run it so let's try it out totally worked so here's what we did we have the ls command still there but we also have a new command that's just network chuck that's because we copied the binary contents of ls to a new file named network chuck and if we try to use that command what do you think will happen let's try it out network chuck it's the ls command that's that's kind of cool right anyways let's delete the ls command we can do that let me clear my screen once more new command time the command will be r m very simple two letter commands right now rm stands for remove and much like the copy command no explanation necessary it removes crap it removes stuff so i'll say remove ls now as you may imagine we'll also need pseudo permissions to remove this so i'll go to the beginning of my command and type in sudo so sudo rmls and it's going to go away say bye it's gone so now what do you think will happen if we type in ls let's try it ls nope it's gone but not a big deal like we still have network chuck don't we it still does the same thing so we're good but for real to return it back to normal all we got to do is sudo copy once more just cp right we want to copy the contents of network chuck to a new file named ls so now if we type in ls once more ah we're back we're good now let's talk about ben again ben he's got all the essential command binaries like we talked about things like the commands we just learned cp copy rm remove and even cat there he is which also means we can cat cat let's try it out cat cat and we just catted cat anyways let's move on so i'm gonna cd dot dot or cd forward slash to get back to our route let's clear things out once more and let's list the contents once more of root so we talked about ben the the bend directory he's awesome but there's also another one over here called s ben or i like to refer to it as super ben ben with a cape on now super ben is just like ben but he's a bit more special you see super ben has special commands that only administrators would use to administer the system let me show you let's jump into super bent so cd s bin and if we ls inside super bin or list as contents we'll see some cool commands some top secret commands that only admins can use we'll take a look at one and actually use it real quick let me score the top here ah here we go add user what do you think that does wild guess it's going to add ourselves a user so let's do that real quick i'm going to clear my screen and we'll do sudo because this is a special command we'll need please please add user and then the username now this is new command time i forgot to say it new command time i'm going to create super ben i feel like he should have a presence right now so sudo add user super bin and it's creating we'll give a password to super bin give him a full name super bin skip the rest of the stuff super ben is alive he's here we added a user but anyways that's what you see in sbin super bing commands let's get back out of there cd dot dot and clear my screen once more let's do ls and see what we're working with again now we're still going to talk about commands for a bit we're not quite done ben had our essential commands super bin had our super essential commands but now we're going to jump into our user directory let's jump in there real quick so cd user usr type in ls while we're there and notice something kind of strange it might throw you off inside the usr directory or the user directory we also have a ben and an s bin huh what's going on here something's up let's take a look inside so cd into ben but inside the user directory let's ls that looks like a lot of the same things doesn't it like is there an ls here yep so same commands here let's jump back for a second cd dot dot and then jump into s ben here inside the user directory let's ls that yup seems to have the same commands here too what's going on it seems like we have some imposters here like which one is the real one ben and root or been in the user directory the answer is both they're both real there's actually a pretty interesting history as to why we have two locations i'm not going to talk about it here but it all comes down to hard drive space look it up but essentially the ben and the super bin directories in the user directory are the same as the ben and s bin in the root directory now ben and s ben in the user directory will typically have more commands there but you will see a ton of overlap here so that begs the question when we use the ls command are we using the command stored in bin or in user bin we can actually find out you want to try it let's try it out new command time go ahead and clear your screen with me here we're going to type in the command which it's going to help us figure out which is it is it in bin or is it in user bin so type in which and then right after that ls hit enter ah so it's the ls and user bin if we which cat it's also in user forward slash ben which if you didn't catch on what which is doing i feel like i'm saying which too much you can use which to find out where your command binaries live so i can actually which that command i made earlier which network chuck so that's pretty cool and that's extremely handy so anyways let's um get back to our user directory cd dot dot let's ls once more so again here in our user directory we have ben and super bin carbon copies but a bit more power we also have a local directory which you can hardly see let me back up there our local directory which similar to ben and super bin will store command binaries but it's here that you'll want to store the command binaries that you might create anyways let's move on the user directory also has some fun stuff like libraries that the command binaries will share and apparently it has games that's fun so we don't use a directory let's get out of there cd dot dot let's ls once more to see our root location here now real quick speed route boot what is that files your system needs to boot boot files self-explanatory let's move on var will have things like log files and also web application related files we'll talk more about that later temp or tmp temporary files files that go away after a system reboot or something another lib directory more shared library files specifically things your system needs to boot okay speed round done some more stuff some more key directories here in the route first home home is where you live home is where we live in fact it's where every user lives on your system let's take a look inside cd home now what's ls there real quick aha two homes one is our home and then one hey super bend has a home too if we see the it's a super bin and ls his stuff ah there's his house all right we're on welcome here let's get out of here let's get back to our route now every linux system has a root user but we didn't see a home for the route where does he live because he wasn't in this home but you may have noticed that he is over here all by himself he's special he lives somewhere else where people can't bother him he's kind of a recluse or a recluse i don't know how to emphasize that we can list the contents of root let's do a pseudo because we'll need his special permissions to look inside his house sudo ls root and we're looking inside the root directory there's all his stuff anyways let's keep moving now earlier i mentioned that even devices in our system are files hard drives printers cd-roms you want to see them they're right here in the dev directory dev stands for devices let's go take a look well cd dev let's ls that sucker oh a lot of weird stuff going on now we could spend all day here but we're not going to we're going to look at one thing vda and vda1 those right now are our hard drives they stand for virtual disks on other linux systems you might see this listed as sda or sda1 and that's our hard drive that's the disk it's a file which means we can cap that sucker so let's do that now it's this is gonna be a little rough it might scare you and i'll show you how to stop it here in a second but we're going to do this we're going to cat our drive cat vda i believe we will need pseudo permission so i'll put a pseudo here at the beginning ready for this it's going to blow up and it's gonna keep going hurry hit control c and it stops yeah whoo but yeah that's all the binary and gobbledygook and all the stuff that your hard drive is it's a stinking file which is really cool and really really weird you know but anyways the dev directory is where devices live now i also mentioned that the settings of your linux server or your linux computer are files things like your network settings are stored inside a file you want to see it let's go see it real quick these things are stored in the etc file which stands for etc officially i think so you might hear it referred to as the etc file or directory but people mainly call it in the linux world the etsy file which was here first before etsy.com so they stole the idea but let's jump in there real quick let's jump into our etsy file so we'll see the etc you'll go here a lot because configuration files of your system are here as well as some applications they can throw some stuff in there too if we lsd etc directory a ton of stuff almost too much stuff but let's focus on one set of configurations let's focus on networking so right here we've got our network directory let's jump in there cd network let's lsd network directory and we got a few things going on here but the thing i want you to see is the interfaces file let's take a look at that let's cap that sucker cat interfaces ah we need to say please sudo cat interfaces there we go here in a file are your network interfaces and they're assigned ip addresses this is where they're configured pretty cool and if you wanted to change your network settings you would often go into this file and just change it here now things do work differently on some linux systems nowadays but this was a common way to do it and is still the common way to do on some systems now we're almost done i know it's been a lot but i got to cover this i've got i got to show you this stuff let's get back to our route cd forward slash clear the screen two more places i want to talk about let's ls the route so last two here we go here we have the mnt directory and the media directory they both do the same thing they mount drives if you plug in a usb flash drive into your linux box here it will automatically and auto magically be mounted to the media directory as a file because everything's a stinking file remember so media is mainly for your system mounting things automatically for you whereas the mnt directory it also has drives mounted to it but it drives you might mount manually you would actually use commands to mount a drive and again that would be represented as a file in the mnt directory now i think we covered most of it like almost all of it if you're still curious about any of the remaining ones let's ls that real quick there are a few we didn't talk about and maybe a few you want to review go check out the hack the box academy right up here they do go over most of the ones we mentioned here and some we didn't so refer to that wow we covered so much in this video oh you need coffee for this but it was awesome right so we like we saw that everything literally everything in linux is a file and we jumped around the different directories and looked at everything from devices to commands to configuration files and we covered what the main directories actually are for and that's key in learning linux because when you are doing stuff in linux when you're messing with applications or configuring things or hacking it's important to know where stuff is and where stuff should go and then while we were jumping around and exploring our linux file system which officially is called the fhs how it's arranged the file system hierarchy while doing that we learned a bunch of new commands things like who am i cp or copy rm or remove add user which cat so we did a lot today so here's my homework for you i want you to first make flash cards of all these commands i want you to commit these suckers to memory second i want you to practice using these jump around if you forget who you are type in who am i copy things remove things be careful though although if you're using this hack the box lab you can just restart it it's fine witch cat which cat all kinds of stuff cat cat the more you practice the faster you'll learn linux the better an engineer you'll become now that's your homework but i also have a challenge for you i always have a challenge let's see what you got and i'll actually have that quiz linked below the first one to get all the answers right will win a gift card to network chuck coffee so you can grab yourself some coffee or a shirt or a mug or whatever hurry up well guys that's about it huge shout out again to the sponsor of the series hack the box academy this is the structured learning platform for hack the box it's where you want to come to learn how to hack and also it's what you can use right now as a free lab as you go through this course so if you haven't already signed up i mean what are you doing you can practice for free right now right now and of course don't forget to hack the youtube algorithm today hit that like button subscribe notification bell comment all that stuff let's hack youtube today ethically of course and yeah that's about all i have this was episode two of my linux for hackers and everyone course i'll catch you guys next time [Music] you
Info
Channel: NetworkChuck
Views: 1,464,194
Rating: undefined out of 5
Keywords: linux file system, linux for hackers, linux for everyone, linux for hackers ep 2, linux directories, linux fhs, parrot os, kali linux, linux tutorial, learn linux, linux course, linux beginner tutorial, linux file system hierarchy, linux file system types, linux file system explained, linux directory structure, linux tutorial for beginners, gnu/linux, linux file system commands, linux for beginners, directory structure, linux
Id: A3G-3hp88mo
Channel Id: undefined
Length: 20min 33sec (1233 seconds)
Published: Fri Apr 09 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.