Menu

If you have a Das Keyboard Model S Ultimate, it’s likely that one day you will no longer be able to resist the temptation of disassembling its keycaps.

You might be surprised to discover that not all the keycaps are the same. If you look inside the keycaps, you will see letters and numbers. Notice them, and use this map. (R4 are the keycaps with only numbers inside.)

Warning: DON’T run this code, unless you understand what it’s going to do.

This is bash fork bomb:

:(){:|:&};:

If you run it, it will keep forking a process and stuck you operating system. You’ll most likely have to reboot to get your computer back }:-D

Why does it work?
Well, the trick is in the colon “:”. A colon is a valid name of a bash function. So the above code is equivalent to this:

bomb() {bomb | bomb&}; bomb

and after indentation:

bomb() {
bomb | bomb&;
};
bomb

It’s not easier to see what is happening here:
We defined a bash function called “bomb”. It forks itself recursively, and sends one of its instances to the background.

Why run in the background?
If we run the recursive call in the foreground, the calling function will not complete until the call returns.
Since there is no stop condition for this recursion, the calling function would wait forever, and we’ll have only a single instance of the function running. Killing it would be as easy as ctrl+C.
On the other hand, when running the recursive call in the background, the calling function will complete immediately, and the recursion can continue.
(It’s almost impossible to kill all these instances of the bomb even with the kill or killall commands, because the number of processes will grow exponentially and will utilize the whole CPU in a very short time. Leaving us with the only option: Reboot)