 There are many dangerous commands that a user could enter into a terminal and Actually calls their Linux installation to crash or in some cases you could permanently break your Linux installation So it's a good idea to actually share with people what some of these dangerous commands do what they are the most obvious One of course is the old sudo RM dash RF enroute now This should be pretty obvious to most users the RM command of course is a remove command It's a delete command you use it to delete files or directories on the system sudo gives you root privileges meaning you have permission to delete any file or directory on the system dash RF means recursively delete all files on the system F means forcibly delete all files on the system and enroute means start at The root level directory and then go down so a sudo rm dash rf enroute what that does it deletes every single file and directory on the system That's dangerous. That's that's obvious that that is dangerous Most modern Linux distributions actually won't let you run that command At least they won't let you run that command without jumping through it extra Hooper to right because obviously it's gonna break the machine But another common command that is a kind of a denial of service attack a DOS attack is the fork bomb the fork bomb It is a shell script typically, but it could be written in any language It could be you know any script or piece of code that you execute on the system and what it does It continually forks a process So you start with one process and it forks itself into two processes and those fork themselves into two processes each four processes Yada yada yada until you've got you know all of these processes on the system that keep Forking themselves until your system runs out of memory and the machine locks up now again a fork bomb can be written in any language I found this repository over on github this fork bomb repository that this guy created where he's just Collected I don't know probably 30 or 40 different fork bombs written in a variety of different languages The most common one by far that people use again to take down Linux servers Especially is the shell script fork bomb which you've probably seen people share this this code right here that line If I entered that line in the terminal what that will create a fork bomb that will start forking all of these processes Right until the system completely locks up So the shell fork bomb is really interesting because it's just these special characters, right? And if you didn't know shell scripting you really wouldn't know what all of these special characters are actually doing so Let's actually explain this so let me open up a emacs buffer and let me zoom in on the wrong desktop here Zoom way in here and what I'm gonna do is I'm just gonna create this Example block here and let's go ahead and paste the shell fork bomb So if I entered this in a terminal again, it would eventually lock up my machine And then I would have to power off the machine I'd have to physically power off the machine and restart the machine reboot the machine to Actually get the machine back to working so the fork bomb really shouldn't do any Permanent damage to a machine but still I wouldn't run it just for fun Not on a main like production workstation or something if you want to test out the fork bomb Try it out in a virtual machine a virtual machine. You can't really hurt anything So the reason the fork bomb looks so weird in this example here is it's because it's all on one line If I actually wrote this using line breaks like you would if you were actually doing this as part of a shell script Rather than how they have it on one line like you would enter it in a terminal I think it would explain this much better So if I did colon and then opening and closing parentheses and I did an opening and closing brace and then space over a couple of times and I did colon pipe colon space and then the ampersand there and then let me do a Simi colon right there and then finally I want you to run Colon so for those of you that are familiar at all with shell scripting now it probably makes sense What this is doing? We are defining a function, right? So we actually defined a function here We did a colon and then the opening and closing parentheses. We can name a function anything So this should be function name opening and closing parentheses That's typically how you define a function and shell scripting and they've decided to name this particular function colon Why did they choose colon as the name of the function? Well, just to keep with the special character theme because it kind of obfuscates What's really going on here by using a colon as a function name? It's not obvious that that was a function there at the beginning, right? So colon opening closing parentheses is the name of the function, right? And then the braces here inside the braces is what the function actually does. What does the colon function do? Well, it runs colon it runs itself and then it pipes it into colon So it pipes it into itself and then the ampersand Means keep that process that you're currently running running as a background process So don't kill it because typically when you run functions They'll run and then you'll run another function and the previous function will kill itself, right? It basically the new function replaces the old function, but here we want forks. We want each Process that gets created to continue to run, right? We don't want any of them to ever terminate themselves And then we have the semi colon here now the semi colon because we're doing line breaks in a script would not be necessary It is necessary to have that semi colon if you're doing a single line because that signifies. Hey, you know We've defined the function and now colon we're running the function if you have Doing all this on a single line though. You need to add the semi colon so there's a clear separator there So that's the fork bomb explained. It's really really simple what it's doing It's not a complicated thing at all and because it's not complicated, you know I think more people should know what these things actually do Another common fork bomb if they don't do it in like POSIX shell script Sometimes they will do a bash specific fork bomb, which honestly is even simpler Let me actually copy that. Let me get my emacs back because it would be easier once again to explain this Using a little bigger font than what's in the browser. So this is the bash fork bomb Now, what is it actually doing? Well anybody that's ever executed a script knows you execute a script with Dot slash right. So what we're doing here is a dollar sign zero is the name of The script itself. So we want to do dot slash name of script So run the script and then the pipe symbol meaning, okay, we're gonna run the script and then we're gonna pipe the script into Dot slash dollar sign zero That's the same thing as before it's just written a little differently bash syntax is a little different than a POSIX compliant Shield syntax and then the app or sand once again keep that process running. So it just creates this infinite loop Where you're constantly rerunning this script that's constantly running itself piping itself into itself and all these background Processes just keep Replicating until the system locks up. So that is the bash fork bomb and that is the shell fork bomb Those are the two most common that you'll see if you check out this repository and I'll link to this particular Fork bomb repository on github. So you guys can check the code for C C plus plus here's one for Haskell Let's check this out. See if it's obvious what it's doing. Yeah, so it's importing This library here forever and this library here a fork process for process Obviously, it's gonna take a process and fork it right and you can see we're gonna basically create this function here We're gonna call it fork bomb and then what is it equal it equals this forever process. I'm not sure what that does I'm assuming just make something run forever and then we run fork process on fork bomb itself So we're forking the fork bomb, which is the function. We're running, right? So it's basically the same thing. It's just a recursive kind of loop where we take a process It runs itself it forks itself and nothing ever terminates, right? We keep all the running processes running and forking into eternity essentially So that's just a quick little look at the fork bomb really interesting small pieces of code that again I think it's educational to actually understand what some of these things are doing I also think it's educational for you guys that see these things, especially that posits compliant shell fork bomb You see that thing posted all over the internet. I want you guys to be aware of what exactly that is So you don't accidentally enter that thing in a terminal and then wonder why your computer locks up Now before we go, I want to thank a few special people I need to thank the producers of this episode and of course I'm talking about Gabe James Matt maximum at Mitchell Paul West Wanya Bald, Homie Alex, Armored Dragon, Chuck Commandering, Erie Diyoka, George Lee, Marshtrom, Nate Erion, Alexander Paul, Peace, Arch, and Fedora Polytech, Realities for the Less Perfect, Roland, Steven, Tools, Devlin, and Willie These guys they're my house tiered patrons over on Patreon without these guys this episode You just watched would not have been possible The show is also brought to you by each and every one of these fine ladies and gentlemen all these names You're seeing on the screen right now. These are all my supporters over on Patreon because I don't have any corporate sponsors Corporate sponsors. They don't sponsor fork bombs, right? I depend on you guys the community. So please check out distro tube over on patreon. All right guys. Peace