Bash Fork Bomb And The Cure
A fork bomb is a simple bit of shell code that, once run, will soon fill all available memory and fork space with itself. Here is the code, and remember, don't try this at home!
$ :(){ :|:& };:
To explain what is going on we need to cut this code into sections. The first thing we do is refine a function called ":", which accepts no parameters.
$ :(){};
We then get this function to run itself recursively and also to run another version of itself in the background, this creates another fork of the program.
$ :|:&
Finally we start it all off with the first function call.