 Today I want to talk to you about some of the dumbest things that I have done on my Linux computers I have broken my machines many times. I've done some really dumb things entered some commands I shouldn't have entered in the terminal. Yeah, I've really done Some things that are real head scratchers when you think about it even when I think about you know Sometimes I do these things, you know, and then I was like why did I do that? And you guys if you've been a long time Linux users, you know Chances are some of the mistakes that I'm gonna talk about on camera today You guys have made these mistakes and if you haven't made these mistakes Trust me if you use Linux long enough, you're probably going to make most if not all of the mistakes I talk about today So let's get the most obvious mistake that I've made out of the way the old sudo rm-rf command So we're forcibly and recursively removing files and directories that command rm-rf very very dangerous and I have on at least two occasions Wiped out my home directory. I have actually blown away my user's home directory and all of my user data You know all my documents and videos musing and everything now. Thankfully in most cases I've got backups for the really important stuff But still, you know, you get that really sick feeling in your stomach when you blow away an entire home directory Again, I've done that on two occasions I know the one that everybody talks about is sudo rm-rf on root But you typically can't remove the entire file system with the rm command on at least most modern Linux distributions They have protections in place where if you try to do a rm-rf on root They won't let you do it without you jumping through some extra hoops You know, you have to add another command an extra flag You know, you have to give them a little bit more information as a confirmation. Hey, I really want to run this command I really want you to delete the entire root file system. So typically you're safe from that But you're not safe from deleting your home directory Typically there are no protections in place for that and again I've done that on a couple of occasions And I'm not the only one because I see people all the time on Linux forms Not all the time, but it's a very common occurrence when people talk about their Linux horror stories Deleting your home directory is one of them So be very careful with rm-rf and really be careful with any recursive terminal command because I've also Ruined some Linux installations completely hosed a couple of Linux installations By doing a recursive chmod chmod is change mode change permissions of files And you never want to chmod recursively Like on the root directory So you basically change file permissions for every file to the same file permissions, you know in the entire file system And when you do that You have completely broken your system because certain files in a Linux file system have to be a certain permission And when you recursively chmod everything to I don't know permission 7 5 5 for example Well, your system is completely broken because there's a lot of things especially in the root file system You know and like slash etsy slash boot and slash prog slash You know There's a lot of things in those directories that needs certain permissions And you can't go back and put The the genie back in the bottle once you run that command right you can't unfire that bullet once you've done that recursive chmod You've completely messed up your file system and you're you're never going to be able to fix it You might as well just start reinstalling right then so just be very careful with those recursive terminal commands Don't ever run a recursive terminal command on root Just don't ever do it and also be very careful when you run a recursive command on your home directory Especially if it involves the remove command along the same lines I've also run into this situation with these recursive commands where I didn't enter them in a terminal But I was using them as part of a script. I was doing these fancy scripts You know where I changed things on my file system via a bash script for example And sometimes I had unintended consequences using rm In a in a bash script for example sometimes with the dash rf flag But sometimes not sometimes I using rm as part of a for loop or part of uh xr You know exec or whatever it happened to be but for whatever reason, you know, I I didn't think Through this bash script properly and it was basically removing files and directories It shouldn't I've done that before where I wrote a script and I ran it And like it deleted, you know have my home directory, right? And it was supposed to really just delete files in one directory But you know or maybe the way I wrote the script You know it was supposed to be executed from a particular directory And if as long as it was executed from that directory, it would be all right But if you moved the script and ran it from that directory Then something else would happen. So be very careful when you're scripting Especially with dangerous commands like the rm command or the chmod command again Another really dumb mistake I've done and it's one of these mistakes We all do if we've used linux for long enough, especially if you distro hop a lot and so you're constantly Reinstalling linux distributions. Sometimes you format the wrong drive, especially those of us that have Done the dd command so it typically when you do command line installations What you do to format a drive to wipe a drive you'll run the dd command on it The problem with running the dd command is it's very easy to do dd and then the path To the wrong drive. For example, I wanted to format slash div slash sda But for whatever reason I typed slash div slash sdb Oops, right. So be very careful with the dd command again That's one of the ones that I think if you use linux long enough Especially if you're constantly hopping reinstalling operating systems and you have multiple drives and a machine Eventually you're going to format the wrong drive. Just just prepare for it and again for really important data Always have a backup another mistake. I've done many times as I've accidentally removed the wrong packages So I do all of my package management stuff at the terminal. I've never used graphical package manager So I'll just use the apt package manager if I'm running debian or ubuntu or pacman if I'm running arch or whatever distribution They all have package managers command line package managers You can run in the terminal and sometimes you'll run into a situation where you'll run a package manager command And for whatever reason it goes and removes Programs that you didn't expect it to remove for example on arch based systems I have run the command to remove orphan packages before and one of the Orphaned packages that it removed was the linux kernel That's that's bad because you go to reboot and without the kernel right your computer is not going to boot But have no fear, right? That's actually an easy fix All you have to do is get a usb stick with a linux distribution on it You know and use that stick to cheroot back into your arch linux installation and then install or reinstall the linux kernel And then reboot voila You know you should be back up and running on ubuntu I've run into the situation where sometimes, you know the ubuntu desktop package Is a big meta package of the gnom desktop and you know a bunch of other utilities And before that the unity desktop was like this as well Where sometimes you would go and remove a certain component of the unity desktop or the gnom desktop And it'll just remove the entire desktop environment So and without the desktop environment then you're stuck in a tty when you reboot because you don't have a desktop environment If that was the only one installed on the system But again, that's an easy fix because just go to the tty, you know the terminal and just reinstall gnom or unity Whatever plasma, whatever desktop accidentally got removed just reinstall it then you know reboot You should be good again another mistake. I've made a couple of times Just a couple of times and usually I I don't do this now because I know not to do This but when I was kind of new to arch linux sometimes I would run a partial upgrade What a partial upgrade is is you upgrade some packages on your system But not all the rest and the problem with that with a rolling release like arch linux is every package in its repos are built Against the same set of libraries So if you do a partial upgrade and the way a partial upgrade works is if you ran the command Pac-man dash capital s lowercase y to resync the repos and then give it a name of package You know it's for example htop Well, it's going to update htop to the latest package But it doesn't update the rest of the system to the latest package and latest libraries So you'll have that one program that you updated That's is on the latest version But the rest of your system is not on the latest version and sometimes doing that can call some really unintended Consequences where packages are broken and things you know things just don't act right So never do a partial upgrade and speaking of packages I don't do this much these days because package management on linux isn't a much better place than it was You know 10 15 years ago But back in the day I really I built too many things from source because there were things that I wanted to install Programs I wanted to install that weren't in the repos for whatever distribution I happened to be running at the time so I would just go grab the source often get hub or get lab Whatever, you know, wherever I could find the source and if they had instructions on building that package from source I just build it from source which means that program is not managed by the package manager on my computer anymore Because the package manager didn't install it. I installed it right now I manually compiled it and installed it And you know if you do that a lot if you have a lot of programs on your system That you've compiled from source that aren't being managed by your package manager That too can cause some some headache in your life because now you're responsible For managing those packages making sure they're up to date when they break you've got to go fix them Where if they were just in your distributions repositories, it wouldn't be a problem Now, of course, I said these packages aren't in the distributions repositories So why am I building them from source? Well back in the day I didn't have any other choice But now typically if they're not in your distributions repositories Those packages chances are are available as a snap as a flat pack as an app image or in some of the programming language Specific formats or in the nicks of the package manager and the geeks package man Like we have so many more options today than we had 15 years ago another similar problem I ran into back in the day But you know, I probably would never do this now But I did it a couple of times when I was kind of new to linux was adding new repositories to my linux distribution And by adding new repositories. I'm talking about repositories that really didn't Go with that particular distribution. For example, I sometimes with debian based distributions Would just switch all the mirrors from stable, which most debian based distributions are on the stable branch I just switch all the mirrors to unstable and do a massive upgrade of a thousand plus packages and then reboot And hope the system was working now, but now on the latest packages because I'm on unstable That's typically dangerous. The the chances of that working are very very slim Asked me how I know and a couple of times I have done the really dumb thing Of using a repository from one distribution adding it to another the most obvious example of this is adding a debian repository To ubuntu Which I mean debian and ubuntu aren't they both debian based distributions, right ubuntu is based on debian? Well, they are but I mean ubuntu Is really much more of a fork from debian like it really does its own thing and those packages that are in the ubuntu Repositories those package versions may not match what debian is on So that is a really dangerous thing like if you for some reason there's something in the debian repo That's not in the ubuntu repo. So you add one of the debian repos Maybe the debian unstable repo just to pull down that one package that you want from that repo on an ubuntu machine Oh, don't do that. I like really don't do that. It may work for you But there's a very high likelihood that you're gonna break things and I've read some just crazy horror stories of people doing Even more ridiculous things with adding repos. I remember reading one guy I don't know if I I'm assuming he was working with servers because of the two distributions He was doing this on he mentioned that he added a debian repo To a sentos installation And then you know when he went to install thing Like he was I don't know if he was able to get that to work But he was asking people could he do it like he wanted to try it and everybody was like dude That's the craziest thing I've ever heard. How are you gonna add a debian repo to sentos? Which is rpm based distribution debian of course uses deb package formats But even if it could work even if they were both deb based distributions or they were both rpm distributions They're not still on the same package versions, right? If they're different distributions like never ever add a repo from another distribution to your distribution because again, that's just You are going you're almost 100 guaranteed to break your installation. Just don't do it So that was I don't know seven or eight really dumb things I've done on my linux installations And honestly, those are kind of common mistakes that a lot of linux users have made If you go to linux chat rooms and subreddits and forums and whatever it happens to be any kind of support Channel for a for a linux distribution. You will find many examples of people Removing directories. They shouldn't remove or you know Removing packages. They shouldn't remove doing these weird things entering a terminal command To do something recursively that they shouldn't have done just make sure You know, it's not one of those things. That's the end of the world Most of these have easy fixes the only ones that are very serious are the ones that are actually deleting your data You know deleting your entire file system or your entire home directory Those are very dangerous if you don't have a backup now if you have your data backed up even those No big deal, right? You just go grab your backups You'll be back up and running in a matter of a few minutes in the end all of these mistakes that I've made They're learning experiences now You know when I make these mistakes like if I made any of these mistakes now I know exactly how to fix them because I made them in the past some of them I made multiple times in the past. So it's again, you know, don't view mistakes as some unfortunate event In many cases, you're a better linux user for having made these mistakes Peace guys