 Learning the terminal is an important thing that you'll end up having to do as you meander through your Linux career. And it's not something that everyone does right away. Usually it's once you progress past your first distro and you start experimenting with the deeper complexities of the Linux file system and things like that. And for most people, it's a relatively simple process. There's a lot of documentation out there on how to understand the Linux file system, understand bash commands, understand the GNUDU utilities and all this stuff. There's just a ton of documentation out there. And I highly recommend anytime you come across a command that you don't know, use the word man and then the command you want to learn about. So basically it's short for manual. And so for example, if you wanted to find out a lot about bash, you could do something similar to this. So you do man bash, and you'd get a very long piece of documentation about bash. And it works for many different things. So you press Q to quit out of these. So let's just say you wanted to do man CD, you could do the same thing for that. And you can navigate with your scroll wheel on your mouse where you can use the Vim keys, which is J and K to go up and down. If you want to search for something specific, you can do the slash and then search for something like path, or in this case, we'll have to do that. And they'll tell you, it will show you where that word is everywhere in the man page. And you can use the N key to scroll through each instance of that word. But honestly, that is not the reason for this video. That's just a helpful tip that I think everyone should follow. If you don't know something, find out if there's a man page for that command. Chances are there, there's going to be. You can find out pretty much everything you need to know about those man page. Now I will, just before we move on to the actual main topic of this video, I will say that sometimes those man pages can be very technical in their pros. So you'll want to make sure that if you can't understand what it's talking about, maybe hit up Google and search for how to use blank, whatever command you're looking for. Chances are someone has written up a very layman's guide to using that command, especially the most popular commands like CD and LS and move and copy and all this stuff. There's a lot of documentation on the internet if the man page doesn't make sense to you. So we just wanted to point that out before we actually move on to the main topic. And the main topic for today is to be very cautious when it comes to using sudo. So if you've never used sudo before, let's just talk for a minute about what that means. So let's just go back to my terminal here. And if we did something like sudo vim or sudo nvim in my case, and then try to get into my i3 configuration file, so slash or my repo i3 config like that, I can do that. It's going to ask me for my root username and password, the one that's associated with my account. And in certain scenarios, this is something that you might need to do. In this case, this would be absolutely incorrect to do because this file here does not necessitate root privilege in order to edit. So what sudo does is allows you as your users. So in this case, my user is Dr. M. Dub. That's my username. And what sudo does is allows me as Dr. M. Dub to execute the command that I want to do as root user. So this is useful for when you make changes to files that are in your root directory. And if you don't know what the root directory is, it's the one that sits above your home directory. So things like Etsy, things like bin, things like user share, things like that. So if you are in, so just we'll go up a level here. And if we do an ls, this is my root directory. Anything that comes from here and I want to edit, I'm going to need to use sudo privileges. And the thing about sudo is that if you use sudo to edit anything from here, you need to know absolutely what you're doing. If you don't know what you're doing, you shouldn't do it. That's kind of the whole point of sudo is that it requires you to know precisely what you're doing. And I would go even a step further. Not only do you know what you're doing, but you need to understand why Linux is requiring you to have root privileges for this thing. If you don't understand why it needs root privileges, you probably shouldn't use sudo because it's just a possibility that you might do something that could affect your system because these files here make up your entire Linux system. If you change something or delete something or move something around that you're not supposed to move around, but you've given yourself permission to move around and you move that thing, this is really confusing. Let's see if I can start over again. If you move around something that you're not supposed to move around, your system might break. So let's just, for example, say we move the Etsy folder into slash home. My Linux system would then break. It would not work anymore because the Etsy folder is not where it needs to be. I'm talking about this folder right here. This is probably one of the most important directories on your computer. You shouldn't touch it unless you know absolutely what you're doing with it. So just stay out of it, unless again, you know what you're doing. So if you were to move that anywhere where it's not supposed to be, your system would break. And that's what makes sudo so dangerous because sudo gives you permission to play in the playground where you might necessarily understand all the rules of the playground if we can mingle a metaphor for a little while. Because if I did sudo, just to live on the edge of danger, sudo remove dash rf slash Etsy or just Etsy here. If I did that, that'd be removing Etsy. My system would break. But I have the ability to give myself permission to do that if I wanted to. I don't want to do that, obviously, but I do have to. And you can see if you don't know what you're doing with sudo, you have the opportunity to break some good stuff. And it's not even necessarily big stuff like this that you can change or that you can mingle beyond recognition and cause your system to break. You could be inside the Etsy folder and changing, like for example. So if we see it into Etsy, in here there is a file called, see if I can find it here. This stuff is in alphabetical order, so it should be easy. So packman.com. So if we just do them and them into packman.com, like so, this is the file that basically tells packman where to get this stuff from and a few other settings. And by default, I can't edit this. So if I make changes here up at the top, I can make some changes. And if I had colon W, it's going to tell me there at the bottom. If you can see this read only option is set is set. So that means that it's you don't have permission to edit this with your standard privileges. You need sudo in order to do that. So we're going to get out of this. And let's just say I was in that file as sudo. So if I do sudo and them and then packman.com, do that, enter my password. Now I can make changes to this all I want. And I could do something stupid, like delete it all. Like I could delete all the things in here. And then packman might not work. I think that it would probably still work. There's probably like a fallback position for packman. But it would probably not pull from any repositories whatsoever. I'm guessing that that would be the way the packman would work. I'm not going to try to find out. So it would definitely not work as expected if it worked at all. That's the point is that I have now given myself permission to edit this file. It doesn't necessarily mean that I've done something stupid like delete the Etsy folder or the Etsy directory. But I have edited a file that I needed to be completely aware of what I was doing to make sure that I didn't make changes that could break either an application on my system, in this case, packman, or the entire system itself. As I said before, make sure you know what you're doing if you use sudo. In fact, I would go so far as to say it's to never use sudo at all unless bash tells you to. So if we actually go back to this here and we get out of this, I don't want to save anything. And if I do this, remove packman.conf. I'm going to get an error. Well, it's going to ask me if I want to remove the right protected file. So in some cases on some distributions, it's going to tell you that it just won't remove it will give you an error. This full this command necessitates group privileges or something along those lines, or it's going to give you this one is always going to warn you somehow and you're going to need to actually confirm. I'm not sure if I do this, if it would actually work, it may still ask me for a root password. I'm not sure if it will or not. I'm not actually going to try it or not. I'm just going to get out of that so I don't actually delete something. But you can see that there are built-in mechanisms included inside your shell. In this case, I'm using ZSH, but the same ones are there for bash. There are those built-in mechanisms that will tell you moments when you need root privileges and then you can use sudo if you need to, if you know absolutely that you need to do that command. One last thing, a lot of times when you're first learning Linux, the biggest sin that you can do is Google a tutorial on how to do something and then just copy and paste the commands. And while we're all guilty of this, every single one of us has gone through and done this when we first started using Linux and it's a good possibility that even people who have used Linux for a long time still do this. They go to a website, it has a tutorial on how to do something and one of those commands requires root privileges. And you just copy and paste that into your computer, assuming that it's doing what the article has told you it's going to do. And probably for the most part, it probably does. But it's also possible that it does something nefarious and deletes your home directory or deletes your Etsy folder, whatever. It's possible. And that's why it's absolutely essential that when you go to a tutorial and look for commands on how to do something, that you understand the commands that it's telling you to do. And if you don't know what those commands are telling you to do, don't follow the tutorial until you do understand it. At least some understanding of what the article is telling you to do is essential in order to make sure that you're not following an article telling you to delete your root directory, you know, because there are assholes on the internet and it's a good possibility that if you find one of them, you know, they're not necessarily rare and you do something based on an article that you assume is legit, it could cause you some problems. So just know going in that you need to have some level of idea about what those commands possibly could be and it'll save you a lot of trouble in case you come across a article that's not necessarily on the up and up. So that is it for this video. If you have comments, you can leave those in the comment section below. If you haven't yet already, make sure you hit the subscribe button and the like button. I really do appreciate it. It really does help the channel. You can follow me on Twitter at Lenoxcast. You can follow me on Mastodon and all the other social media things and you can find those links in the video description. You can support me on Patreon at patreon.com slash Lenoxcast. I'd like to thank my current patrons, Robert, Sid, Devon, Patrick, Fred, Kramer, Tridevil, Meglin, Jack Spinepool, Steve, Sabrina, Lenox, Gary, Samuel, KB, TGB, Keith, Andy, Uncle Bonehead, Gary, Antoine, Mitchell, J-Dog, Carbone, David, Jeremy, Sean, Odin, Martin, Ross, Eduardo, Archer, Elliott, Mislav, Merrick, Kamp, Joshua, Lee, Peteray, Crucible, Dark Benedict, Primes, and PM. Thanks to everybody for watching. I'll see you next time.