It's a bash function called a fork bomb, the idea is that it self references and forks each time spawning more and more of it's self. lets rename the function from : to "bomb" to make it more human readable
1: bomb(){
2: bomb | bomb &
3: };
4: bomb
Line 1: is the creation of the bash function named Bomb originally named ":"
Line 2: the contents/commands for the function Bomb (originally ":"), these commands are a self reference, so it runs it's self and pipes it's output into it's self and then the key to it all "&" forks that command into a new process
Line 3: ending the function
Line 4: running the function for the first time
The idea behind this is each time the function is called it spawns 2 more versions of it's self and compounds so.. 1>2>4>8>16 and so on, this all happens insanely fast and after a short time will overwhelm what ever system the command was run on. now some systems do have fork bomb prevention that will actually stop this command from working, but in most cases it will work. if you do run it, make sure your ready to reboot because it's going to grind your system to a halt.
and remember kids, never run some random code from some AWhole on the net :-)
it won't exactly be an infinite loop, the first loop will run and complete... It will still spawn out of control, just at a very slow rate, their is a chance it will bring the system down but it will take much longer and might actually get restricted to just overloading one cpu core.. the & is really the magic part that lets it spin out of control, it's what fork's the process and why it's known as a fork bomb.
10 comments
1 u/UncleAWhole 25 Dec 2017 10:16
my heart still flutters when i see the most beautiful bash command of all
:(){ :|: & };:
0 u/TheBuddha [OP] 25 Dec 2017 10:25
I also have a soft spot for Perl. So, I can relate.
0 u/I_Always_Lie 25 Dec 2017 20:57
Please splain.
Edit: Was about to type it in to a terminal but decided against it.
0 u/UncleAWhole 26 Dec 2017 05:05
It's a bash function called a fork bomb, the idea is that it self references and forks each time spawning more and more of it's self. lets rename the function from : to "bomb" to make it more human readable
Line 1: is the creation of the bash function named Bomb originally named ":"
Line 2: the contents/commands for the function Bomb (originally ":"), these commands are a self reference, so it runs it's self and pipes it's output into it's self and then the key to it all "&" forks that command into a new process
Line 3: ending the function
Line 4: running the function for the first time
The idea behind this is each time the function is called it spawns 2 more versions of it's self and compounds so.. 1>2>4>8>16 and so on, this all happens insanely fast and after a short time will overwhelm what ever system the command was run on. now some systems do have fork bomb prevention that will actually stop this command from working, but in most cases it will work. if you do run it, make sure your ready to reboot because it's going to grind your system to a halt.
and remember kids, never run some random code from some AWhole on the net :-)
0 u/I_Always_Lie 26 Dec 2017 17:02
Cool. Quick question : What if it didn't have the &? Then it's just an infinite loop right?
0 u/UncleAWhole 26 Dec 2017 18:18
it won't exactly be an infinite loop, the first loop will run and complete... It will still spawn out of control, just at a very slow rate, their is a chance it will bring the system down but it will take much longer and might actually get restricted to just overloading one cpu core.. the & is really the magic part that lets it spin out of control, it's what fork's the process and why it's known as a fork bomb.
0 u/I_Always_Lie 26 Dec 2017 19:15
So it's a recursive function that does nothing but take up stack/heap space?
0 u/I_Always_Lie 25 Dec 2017 20:56
I wrote some of my c code with the i[A] instead of A[i] just to fuck with anyone that had to read it in the future. Evil indeed.
0 u/bernicestockstill 27 Dec 2017 16:04
oh yeah, I always have this stupid problem
0 u/NeoGoat 22 Feb 2018 11:36
Thank you, The!!!!