Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

What does this shell command do in Linux

:(){ :|: & };:

How can it be used in Denial of Service attacks?

share|improve this question

marked as duplicate by Shekhar, Nifle, slhck Jul 29 '13 at 19:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 4 down vote accepted

It's a fork bomb. I actually have that written on my whiteboard (as a joke) as I speak. Don't run it.

:()         # define a function named :, () defines a function in bash
    : | :;  # the pipe needs two instances of this function, which forks two shells
;           # end function definition
:           # run it

So, the first run makes 2 subshells, which then each runs 2 more subshells...

: is a built in command in bash. It's kind of a "null" no-op command. It used to be the comment character, before there was a comment character. Now, it's got a small use as a no-op, but really used here because it's more cryptic, you look at :() and think WTH is that?

share|improve this answer
: isn't an operator, it's a built-in command that does nothing. This definition defines a function called :, which hides the built-in command. Here's a clearer and equivalent version DON'T RUN THIS EITHER bomb() { bomb | bomb & ) ; bomb – Keith Thompson Jul 29 '13 at 19:12
Why is everyone saying to not run this? Either Mac OS X is too clever or too broken to let this cause any damage. Just a bunch of -bash: fork: Resource temporarily unavailable, then the prompt is back within a second or so. – Daniel Beck Jul 29 '13 at 19:18
@DanielBeck I (knowingly) ran this on Solaris many years ago, needed to force a logout, though I actually just rebooted (my desktop Sparc). – Rich Homolka Jul 29 '13 at 19:26
Forking exponential user created memory leak. Depending on the OS, hilarity or disaster ensues. Mac knows users will do anything despite? ulimit set to prevent it from working? – Fiasco Labs Jul 29 '13 at 19:55

Not the answer you're looking for? Browse other questions tagged .