Linux Commands for Beginners 04 - Navigating the Filesystem

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome back to my linux commands for beginner series this is video number four so by now you have a Linux system of some sort to use to go through the remainder of the videos in the series whether that be a VPS a virtual machine a physical machine a Linux server basically you have something to go along with so in this video what we're gonna do is look at some basic filesystem navigation we're going to expand on these concepts as we go through this series but I just felt like this would be a good place to start so I'll show you what I mean when I say navigating the filesystem so let's go ahead and dive right in so here I am on my laptop I'm currently running M X Linux just something I decided to test out so not my normal distribution but one I like to fall back onto every now and again but it doesn't really matter what distribution you are running because all the commands I'm about to give you are about the same on every distribution I mean the bash prompt of course looks different for me than it likely does for you unless you're also on MX Linux but other than the prompt itself looking different the commands are the same now when I say filesystem what exactly do I mean well filesystem can mean a couple of things in Linux it could mean the way that the hard drive was formatted if you use Windows for example you're probably familiar with the NTFS filesystem or the fat filesystem and Linux is no different it has file systems for its hard drive partitions as well but that's not actually what I'm talking about here filesystem also refers to the directory or folder structure of the actual hard drive that Linux was installed onto so I could run the LS command which stands for list storage and press ENTER and then I'm going to see a list of folders in my current working directory now your output may be completely different than this because each distribution comes with different default folders in the home directory which is where I am right more on that in a moment but the takeaway is that the LS command stands for list storage but the file system actually starts with a single forward slash so if I do LS space and then a forward slash I basically see the file system at the very beginning of the hard drive and this will probably look the same for most of you there might be some differentiation here but not much most of the or if not all of the important directories here are going to be the same and yes these are directories it's very common for a folder or a directory to be colored blue you can't always rely on that so I'm going to show you how to actually tell the difference here in a moment but I just wanted to make sure you understand what I mean by file system and what I mean by that in this context is the directory structure of the Linux file system or the way the hard drive is set up or the default folder structure and the folders you're seeing here each have a designated purpose if you run Windows for example you're probably accustomed to a C Drive and it has Program Files yes C users and so on Linux is like that it's equivalent of C colon users is going to be the home directory we see the home directory right here that's where the users are so if I do LS slash home like that you can see I have one folder in there just my name that's mine that's my user directory that's essentially what that is I could type clear to clear the screen but also I could do ctrl L to also clear the screen ctrl L may not always work on every distribution but if ctrl L doesn't work you can also type clear and that just basically wipes the screen so you can start back at the first line so back to the LS command the list storage command this is probably the most important command you to know because you got to be able to list the items in a directory or where you're located but you can also do options for example or add little arguments if you will to a command so if I do LS dash L and then the forward slash let's see how that is different from the original and you can see a lot more information here on the screen than before and everything is basically on its own line now normally everything is kind of jumbled up so if I do LS and forward slash you can see the same list of directories but they're kind of just you know all together they're the - L option is look for long listing that means we basically want to see more details that we want every item to be on its own line this is actually the one that I recommend and most distributions have ll for long listing as an alias it's not an actual Linux command look into aliases later a lot of distributions ship with the ll command but not all of them let's see if M X does why not and it does work ll may not work for you and that's okay if it doesn't we'll get into aliases later but LS dash L gives you the long listing as you can see here and then ll on some distributions are probably a larger majority it's just a alias for LS dash L same difference so I'll clear the screen welcome back to the video in just a moment guys but before we do I just wanted to quickly mention my sponsor Linode Len ode is an awesome provider of cloud Linux servers and their cloud manager dashboard makes it extremely easy to set up your own Linux server in seconds whether you like Fedora Debian Ubuntu or whatever your distribution of choice is you can have your very own Linux server running your favorite distribution in a geographic location near you with the latest one just recently introduced in Toronto so go ahead and check out the link in the description below this video where you can get $20 in credit towards your own linux server so go ahead and check that out and let's get right back to the video so what's up with these folders so I'll do LS dash L and then the Ford slash again the Ford slash is the beginning of the file system so I'm not going to go over all of these folders right here but I am going to talk about a few important ones that you should know about and the first one is home that's a really important one to know and as I already did you know we have a single folder in there I already showed you that's mine and that's my home directory so I could basically just type an entire path if I wanted to every directory is separated by a forward slash and the path starts with a ford slash and you can see if I do that I get a listing of contents in my home directory which is that slash home slash J if I just do LS you see I have the same directories here and that's because I'm actually in the home directory currently so LS if you don't give it a path it shows you what the contents of your current working directory if you don't know what your current working directory is so you could do PWD so let me clear the screen you could do PWD for print working directory and that tells you where you are right now that's the directory you are attached to so when you run LS it's going to show you the listing of contents that's in that directory because I didn't tell it to show me anything else I just ran LS by itself so just to false to where you're currently located now one thing to note too is the tilde right here which is very common that refers to your home directory it's a shortcut so I'll get more into that in a moment but I just wanted you to understand what that tilde is now the rest of the prompt here we have my username and the system name is MX because I didn't actually change it from the distribution default the bash prompt can change we have the dollar sign here which is very common and that's customizable so some distributions will change the prompt accordingly but the tilde is the same everywhere or you know everywhere I've ever seen that is shorthand for your home directory now the CD command is for a change directory so again if I LS I'm in my home directory I see the listings of folders that are in my home directory now if I do CD I could change to any other directory so if I just do slash home and do LS then I see my folder right there I'm not in that folder but I am in the home directory the actual home directory slash home and we see that instead of Atilla T we have slash so /home excuse me the Tildy just represents a shortcut to your actual home directory so if you do CD Tildy then that takes you back to your home directory so that's a lot easier to type then CD slash home slash J I mean you could simply do that it does exactly the same thing as CD Tildy Tildy just shorthand for your home directory basically so I could do a CD command I can actually go to the root of the filesystem so if I do LS you can see the listing of directories there at the root of the file system and again LS dash L shows me the long listing now I showed you the home directory that's where user files and directories are stored or your personal data if you will if you create a user which we'll do in a future video and that user will get a directory there as well every user gets their own home directories so basically if I do the listing again I have my home directory but since I don't have any other users that I've created there's nothing else there so when we go to create users you'll see a folder for every user that you create but for right now we just have that one no I'll do ll again or LS dash L doesn't matter so that's your home directory now I'm gonna get into more detail about these directories in a future video I'm just giving you a high-level overview right now binaries or you know programs essentially go and bin and it's a little bit more complicated than this we'll get into that later but basically the bin directory has a lot of binaries or runnable programs the boat directory has files and folders or whatever is required for booting the system so the bootloader will be there and the configuration for the bootloader will be there actually the bootloader is going to be installed in the master boot record or in efi but that's beyond the scope of this video basically all you need to know is a configuration relative to being able to boot your machine is stored here if you get rid of this directory bad things will happen you probably won't be able to boot when you go to restart the machine so don't do that the Etsy directory I know it says etc' and Linux we always have to pronounce things strange probably one of the first things you'll notice about us and here we have the etsy directory that's how we pronounce that and inside there is going to be configuration files so if I clear the screen and do LS slash Etsy which I could do just actually Etsy since I'm in the root filesystem we have a lot of information here we have blue and white so ok well what's up with that we even have green so let me explain that a little bit without going to in detail at this point since we're just starting out I mentioned before that if it's blue it's a folder if it's white it's a file and if it's green it's a program or a binary that's not always the case but that's the general rule of thumb now the thing is you can't always rely on the colors because that's not default almost all distributions set themselves up to show color when you run the LS command that's not the way LS is normally that's just the way that most distributions configure that it is possible that you might use a distribution that does not colorize the output here so everything might be white you can't always go by that so what can you go by actually well every single file has this little string here at the front that is the permission string we're gonna go into that in detail later but for right now all we're concerned with is the very very first character we'll go over the rest of the characters in another video but right now we're just worried about the one on the very very left and Diaz directory so even if this was white all of it was white we would know that this rc4 dot d directory is a directory not just because it's dot D which kind of gives it away but it starts with a D here so that's a directory if it's a file it starts with a hyphen so this is a file now this can be a little confusing because this is also considered a program and that's because it has execute privileges not going over that right now but essentially a program is a file actually everything's technically a file but a program is a file so it's going to have that even though it's colored green it's going to be either - or it's going to be a D if it's a directory and - for a file which does include Pro there's other things that we can have here at the very first character that I'm not going to go over it's just beyond the scope so the takeaway here is the Diaz directory in a - is file like I mentioned and you know we also have L right here which is a link this is a symbolic link something we'll get into later but basically we have this link right here resolve comm it's not actually a file it starts with an L it's a link it just links to another file and it's actually linking to this one right here it's pretty obvious because it's got like a ASCII pointer right here it's just basically linking to this file right there so I'll clear the screen here and what else do we have here well we have the media directory it's very common and we'll get into this in a future video when you're mounting additional file systems or you know like you basically which could be a hard drive of a DVD blu-ray disc thumb drive it's going to be mounted under media so right now if I do LS slash media there's nothing in there but if I had something in there then there might be a subdirectory so if I plug in an external hard drive I'll have something there the /mnt directory is basically for the same purpose that's for things we mount manually don't worry about that right now we'll get into that later I'm just giving you a high level low level overview so if you don't remember the purpose for all these directories in this video don't worry about it we'll get back into it but there's other directories here I don't want to get too involved into this there's just a couple more I'm going to go over root so slash root it's at the very beginning of the file system that's roots home directory root is a user on all Linux systems that's the god mode user root can do everything so with that said you know don't basically you're logging in as your user and you'll notice if you do LS slash home we don't have a root home directory here but roots the only exception it's home directory is right at the beginning of the hard drive separate out of slash home and we'll go over to user management and changing users in a future video but for right now just understand that root is the most powerful user on a UNIX or Linux system and that's definitely the case here and then we also have the VAR directory which we'll go over in a future video but there's some very important things here like system logs that's an example is something that you would find in that directory so with that said you know that's the all the folders that I want to go over in this video but as a quick recap because we're gonna be building on this the LS command list storage shows you what's in your current working directory if you don't know what that is PWD will tell you where you're at right now I'm at the beginning of the filesystem which is designated by a single forward slash I could use a CD command to go into a different directory like an LS to see what's in that directory and if I do CD Tildy that gets me in my home directory which is actually in underneath slash home and I'm in slash home slash J and that's my home directory so CD can get you around the filesystem LS basically shows you what's in your current working directory - L is very common for me because this is how I like the information presented as you learn commands you'll find that there's all kinds of different options to change how things are presented and this is your first one LS dash L that just gives you a long listing which I find is easier and there's all kinds of things that we could actually go over but I don't want to make this video go on for too long so that's basically it for this video each of these videos will basically expand on the previous one so the concepts in this video don't worry so much if you don't understand them yet we'll keep going through it and I guarantee you you'll definitely understand it if you don't already so just go ahead and play with the LS command the CD command and the PWD command on your system so that way you know you know what all that is and what those commands do and you have a good understanding of that and then I will see you in the next video as soon as I have that uploaded so I'll see you there thank you so much for watching my video I really appreciate it if you want to help me out make sure you check out the discreet shouldn't below this video where you'll find links to my latest book mastering Abu - server 2nd edition as well as my patreon page if you like this video be sure to click that like button and share it on Twitter or any other social media network and be sure to subscribe so you'll be the first to see my latest videos as they're uploaded thanks again
Info
Channel: LearnLinuxTV
Views: 36,547
Rating: 4.9697986 out of 5
Keywords: Linux, Tutorial, Learn Linux, gnu/linux, commands, cli, command-line, bash, linux commands for beginners, linux tutorial, linux command line, linux for beginners, ubuntu linux, command line, linux (operating system), linux tutorial for beginners, linux, linux terminal, linux command line tutorial, basic linux commands, linux basic commands, linux commands tutorial, linux command line basics, commands in linux, introduction to linux, sudo, su, ls, cd, mkdir, mv, cp, chmod, chown, linux commands
Id: MnY0K-3_Fjk
Channel Id: undefined
Length: 18min 9sec (1089 seconds)
Published: Sun Jul 07 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.