Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

I just encountered this command on a linux forum online where the author warned that donot try this command for curiosity. So my curiosity comes. What is the meaning of command “:() { :|:& }; :” in shell?

share|improve this question

marked as duplicate by RedGrittyBrick, BloodPhilia, terdon Aug 8 at 12:44

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.

1  
See Fork bomb for that is what it is. –  Dan D. Aug 8 at 9:37

1 Answer 1

up vote 4 down vote accepted

This fork bomb is described here

In bash, a function can be defined

function_name() { ... }

where ... is the implementation or body of the function

:(){ ... }

defines a function named :.

:|:

runs the function within itself - that is recursively, and pipes it's output to another invocation of itself.

 & 

runs the preceding command in the background.

So that gives us :(){:|:&} to define this function

 ;

separates the command defining the function from the following command on the same line (like cd;pwd)

 :

is a final command invocation which starts running the newly defined function.


Normally, I'd hope that per-user limits on processes or other resources would limit the effect of a fork bomb of this sort. Wikipedia has a description of defusing a fork bomb


Addendum: After writing this answer I noticed this question was a duplicate of

Other related questions

share|improve this answer
1  
Noted with many thanks! –  user3872279 Aug 8 at 10:10
    
And also related Why is whitespace sometimes needed around metacharacters? with a funny story around :) –  fedorqui Aug 8 at 11:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.