Linux Commands I Use All the Time

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
let's talk about the most used Linux commands now I pulled up the history of my commands and I picked out some of my favorites here that I think every user should do or at least know about because terminal is one of those things especially from Windows users coming to Linux they're like where's the graphic user interface for this and a lot of times you just need to embrace that terminal and some of these terminal commands will make you just absolutely love terminal so with this this is a good break in and I'm gonna go over all these commands and just kind of showcase what they do and I personally love them so check them out and try them yourself because it'll change the way you use your Linux box now if you'd like to ask me any questions be sure and check out my twitch our livestream Monday Wednesday Friday and with that said let's get on the desktop ok let's start out with you've jumped into terminal you're presented with this screen or something that looks like it it's probably a little uglier than mine if you want it to look like this I'll put a link up in the top to make your terminal fancy like mine but basically the terminal just to explain what it is you have the user right here is the first one the second one is the name and the PC that you're currently on and this is the actual directory yours aren't gonna look exactly like this but that's basically what this little prompt is telling you so if I want CD for change directory for word which is gonna be our first command is getting around this puts us in the actual root of the directory now if we go CD and then do it tightly we'll go back to the home directory so that's that now let's say we want to list the directory we can do an LS for list the directory and this is our second command as LS and this lists the directory now this right here just does a basic listing now if we do LS - a it includes all of the files in here you see all those dots before the files if there's a dot before the file it hides it from a standard listing so you only get this now if let's say you do LS - a and then put an L on it it does the long listing now I actually have mine set up to always do long listing because I like to see that information however standardless I'm just doing an LSU usually prints across the screen so with that that's listing in CD let's move on to understanding our drives so let's see how much this space is left in our drive so if we do DF for disc free - H for human readable this actually tells us what's going on and we could actually read it it doesn't spit it out and bytes and crap like if you didn't do the - H we want to we're a human so we want to read it like a human so I can see exactly what I have now I have a lot of partitions at a bunch of different stuff in here how is my drives laid out is probably the next thing I want to know so I want to list my my devices so LS for list blk for block this lists all my actual hard drives in here this is a really great command LS BL k and you'll see that we have SD a SD b SD c s DD DD and SD e so I actually have five physical drives in here three of which are three terabyte drives and then also three solid-state drives - which are 240 gigs and one which is about a hundred and twenty gigs over those five drives that are in this system I can tell you two are not being used I have a three terabyte drive that's not being used and 120 solid-state that's not being used that's the power of the LSB okay also the really cool part is this mount point we can see how we can access this drive now SDC is on boot SD c3 is actual swap file and then SD c4 is the root directory which has most of everything so FCC pretty much is the entire operating system this one is mounted to media backup this one's mounted to media games this one doesn't have a partition but this tells you hey what partition do I need a mount maybe you know there's so much you can glean from this command I absolutely love it now the next command is DD now this is actually dis duplicator but often called disc destroyer because if you mess up this you'll really mess up a lot of stuff so the basic format for DD is input file if equals and then you put let's say I had an ISO let's say it was arched ISO and then the output file would be Oh F and equals and this is where it gets a little tricky you see those s das and stuff well we can actually pick out what disk we wanted out of there I noticed that disk dev SDE wasn't being used I can actually make a bootable Drive from an arch ISO directly if that was if that was an actual flash drive in there um I would just put o F and then hit enter here and it would create a flash drive now sometimes you have to do BS on the end of it let's say it's particularly do this but if you do I always do B s equals 1 M this makes all the block sizes 1 megabyte which is pretty much the standard so next up is gonna be you name you name is just basically it shows you information about your system so I like to do you name SR this shows me the system and then also the release version and I'm on 4.19 the LTS version because I was having problems with the latest kernel on my particular system and then I also like you name - a this kind of gives you a whole bunch of stuff it gives you what you on its linux the name of the system the kernel and then you know time date all this other stuff I don't really use all this I always usually just do you name - SLR just just for you know brevity purposes but that is you name next up is gonna be sudo now you see sudo used all the time so what say I want to do something with let's go to media and let's say I wanted to make a directory here and I'm gonna let's say I make junk directory permissions denied so let's go sudo make directory junk put in our password and then we'll do a listing you know you see how that junk directory is now made where I couldn't before it elevates your current user to super user and you can do stuff that your user normally couldn't do so this is a very good command what I see a lot of noobs do is they just do an su for switch user and then they just type in their command and then they run as root so then they can just go ahead and let's say remove directory or RM dir junk this removes the directory but you don't have to do sudo for everything the problem with this is it's fine when you're in the system files because those system files are owned by root but let's say you go into home or let's just let's just do CD and then the title e let's see where it puts us right now it's in our home directory right so that should be home - Titus is where our home directory list for our actual user but since we're running as root we can look at our path name by going PWD and you'll notice we're actually in for slash root and we we are not in home Titus so what happens if you switch to user to root and you do a listing and then you make a directory in here as root let's make a junk directory and we do a listing again that junk directory is now created and owned and everything's by a root so don't use root to run or install files those types of things use sudo because it elevates your current user to super user and it just you're just gonna have a lot better time but don't don't run as root as far as messing around with your home directory or just anything dealing with the user interface a lot of times I see some users run like their file manager is Roo and that's can lead to some very bad things so be very careful when running as root so ahead an exit route and go back to our regular thing and we'll move on to the next command which is gonna be IPA and this just kind of gives us our IP address this is obviously our local internal IP address but this is running on 6910 l o stands for loop loop back and then E&P years are gonna look a little bit different it could be eat zero it could could be a whole different thing but this is just kind of telling us that we're on here we're running on the 24-hour subnet which is 255 255 255 dot zero and this just kind of gives us our IEP you know we want to know our local IP IP space a is fantastic for that so let's go back and we're in the media directory still let's go ahead and make the directory junk again and we'll do a listing and you see how it's owned by root you can see it right here that this is the actual user and this is the actual group it's assigned to so nobody can access this except root but let's change that let's change ownership of that so what we can do is we can go CH own and do the user which would be Titus and then let's make it the wheel group and we'll say junk for the actual directory we're changing I notice how I just kind of skipped ahead that's not like magical editing that's just me starting the directory and hitting tab to autocomplete what I'm typing some huh I'm not of that fast of a diaper so we'll hit OK says it's not permitted so we need to do a sudo and we'll do a listing again and now did you notice that the junk directory now has that but let's say we only want people to read stuff in it and if you look on the left hand side here because this is a long listing for that we can actually change this aspect just a quick rundown of file permissions this right here is read write execute and this is for the owner of that and then the next one read write and execute is actually for the group so the group can read it can't write but it can't execute and then this section is for the actual guests of the computer let's say they don't have any rights they can read this folder and they can execute but they can't write to it let's say you just want to open it up wide open and just let everyone read write and execute anything and everything what you should really never do there's very very few instances where I want this but you can do a chmod and then do 777 and say junk now if we look there that now is you can read write and execute as your owner as the group or as a guest to the actual system now obviously we don't want this but I just wanted to go ahead and do that seven is basically read and write if we do five five that returns it back to how it was because five five says we want it to read and execute but let's say we don't want any executing and we just want it to read and write we can just do seven six six and then we'll do a listing you'll notice it can now just read and write but there's no execute that's a little bit better than allowing executing as a guest user so we're gonna remove the junk directory because we're pretty much done with this folder and we'll go back to home CD now let's go into our downloads directory and see what we have here I'm gonna go ahead and remove super grub and then we can have a couple commands that I want to know as far as zip files we can use unzip and then just type in super grub and this goes ahead and unzips the file so unzips really easy but tar you've probably seen that and I want to explain the tar command real fast tar is when you have that tar.gz which is a linux only zip file basically it does a really good job with compression that's why it's so many people use tar but let me break down the options here you'd always do a dash and then extra to extract what you're looking at if you do see that create so we want to extract V means verbose it means it spits out everything that's going on so we always want to know what's going on so we hit V and then F stands for file so then you'd go the file and then you would type in the actual tar file so it'd be like let's say it was super grub came into tar.gz you'd type that in and it would extract that file so I wanted to layout tar real fast if you're unsure of what command does what you can easily do - - help there's two dashes there and then help so with the - - help command you'll memorize most of this stuff but if you forget which you will starting off just know that you can come in here and see like V for verbose and then you can find the X for executable and F for file all these are just kind of listed here but there's a lot with tar you can like let's do LS - - help and you can kind of see a lot of the other things that you can do with LS I mean there's just a really great thing so always remember the - - help as far as getting help there's the - - help command which is fantastic like LS B okay - - help kind of shows you all the different stuff that comes with this that you can actually do but let's say you need this in a little bit more readable format or you want more examples and other things and the - - help just isn't quite getting you there there's always the man and then LS B okay and this gives us the manual so it gives you the synopsis of what is actually it's doing it gives you the actual description and then the options are better laid out so manuals probably a little bit better for a newbie but if you're just looking for a quick reference - - help usually get you there so there's a couple things that I wanted to go over here so LS again let's look at what's in our downloads folder we have super grub here let's say I wanted to move super grub mv4 move super grub and we wanted to just push this to our root of our home directory so let's do that we'll do it LS and then we'll go CD dot dot this goes back one directory and just so you know what dot dot does dot dot means back one directory one dot means the current directory which there's good let's say I was in home and I wanted to copy that zip file over as well let's go ahead and move and I'm gonna go downloads super grubs if and then let's say I want to move it to our current directory I'm in now I'm going all the way to downloads grabbing that zip file and then putting it in the current directory so if we take a look I'll both of them here no obviously we don't want super grub in this one so rmph removes a file so we can do RM remove super grubs if and it removes this file so that's a great way or let's say we just want to copy that super grub so we'll copy that into back to downloads this copy super grub from our current directory - downloads so we'll go downloads and you'll see it there but since we did a copy we'll do a listing again over here you'll see it's actually in both places so we don't want that so we'll do a remove that's just basic moving of files around in Linux so just remember RM for remove or rmdir for a move directory but let's say you want to remove everything in a specific directory you can do the actual directory name let's say junk had a whole bunch of junk in it and we wanted to remove it we could do a dash R for recursive it means everything in that directory is gonna get wiped out but let's say it just wasn't allowing me to for whatever reason you can put our F the F stands for force it just says hey make sure you wipe it out even if it's something that it for whatever reason isn't allowing me to remove without the force command so that removes the actual entire directory and if you look the junk directories got in it if there was anything in it it would also remove it from there as well so two final commands I kind of want to leave you with is LS PCI and this is kind of a combo command it kind of lists everything in your computer this is kind of neat it was in a current PCI pass-through video I was live streaming and I wanted to just kind of say hey this is a lot of information here it kind of shows everything that's in the PCI bridge of this computer but let's say I only wanted to grab like my actual graphics card so LS PCI and then I can do a pipe symbol which is just a shift and right above the inner key that pipe symbol is what I just type there and then let's do a grep and what grep does is it just says hey find this word and only print that line and we only want to print VGA this shows me I have two graphics cards in this computer I have a 1660 and then also I have a rx 500 or 400 series graphics card this is actually a 580 but for this you can actually kind of know about the LS PCI and grep commands same with LS USB this kind of lists all of the USBs and you can kind of play around with this command greps great with everything so if you get too much garbage on the screen you can really just kind of make and mash these things so let's say I only wanted to grab Logitech he would only print out Logitech which is great but let's say we wanted to just look let's go back into our commands that just spit out a whole bunch of junk and like LS block you see how we had that I was like oh you know what the help I only wanted to know about the size something with this size so let's let's grab size and then it just only spits what I needed to know about the size using the help command so just remember all these commands you can kind of combine and just create magical things with it just it's so powerful I love the terminal but it's absolutely scary getting started and it shouldn't be it's it's something that once you get going on it and you learn it it's so fantastic I absolutely love this and there you have all of the commands that I use on just like a daily or at least a weekly basis in Linux I absolutely love all these commands and man I tell you I couldn't imagine using a computer without them I know when I go back to Windows I miss my terminal I miss using these commands but now you know what I use on a daily basis when it comes to terminal and with that said let me know your favorite commands down in the comments section below because there's just a vast array a sea of commands that you can use in Linux or in this terminal and I just it would take hundreds of videos to probably cover them all so let me know and with that said a big shout out to all my patrons without you I couldn't make videos like this one and I'll see you in the next one
Info
Channel: Chris Titus Tech
Views: 42,719
Rating: undefined out of 5
Keywords: chris titus tech
Id: Y3w4avIJw9g
Channel Id: undefined
Length: 19min 26sec (1166 seconds)
Published: Fri Dec 13 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.