Fork Bomb

A fork bomb is a program which self replicates (forks) until system resources are exhausted.

Here is an example of a fork bomb written in Bash:

  bomb | bomb & 

In Bash it is allowed to use symbols for function names, so we can shorten the above snippet by renaming the name bomb to the colon symbol.

  : | : & 

We can then collapse the function into one line as allowed.

:(){ : | : & }

Lastly, we can collapse the two lines into one line using a semicolon.

:(){ : | : & }; :

Finally we can remove the whitespace.


Subscribe to Linux Developer

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.