An insanely simple way to crash your computer from the command prompt.
The Bash command :(){ :|:& };:
is a fork bomb — a type of denial-of-service attack that exploits the system by rapidly creating a large number of processes, overwhelming system resources and effectively making the machine unresponsive.
:(){ :|:& };:
It defines a function named :
that recursively calls itself twice, once in the background, and then executes the function. This leads to exponential growth in the number of processes.
Let’s break it down character by character:
:()
This defines a function named : (yes, a colon is used as the function name — allowed, though unusual).
It’s the start of a function definition syntax in Bash.
{ :|:& }
The function body. It contains:
:
— a call to the function itself (i.e., recursion).
|
— pipe: passes the output of the first function call to the input of the next.
:
— a second call to the function itself.
&
— runs the piped commands in the background, allowing the function to spawn child processes without waiting for them to finish.
;
Ends the function definition.
:
Calls the function for the first time, initiating the fork bomb.
Never run this command on a live or important system. It can lock up your machine requiring a reboot, and may cause data loss if unsaved work is present.
If you’re experimenting in a controlled environment, you should always have:
Process limits (ulimit
) set.
Root access disabled if unnecessary.
A method to kill processes (e.g., remote kill script, recovery shell).
This is a cleverly obfuscated Bash fork bomb that abuses recursive function calls and background processing to quickly exhaust system resources. It’s a classic example of how seemingly simple Bash commands can be extremely powerful — and dangerous.