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.

Possible Duplicate:
What does this cryptic bash command mean?

Why this command crashes Linux?

:(){ :|:& };: 
share|improve this question

marked as duplicate by MaQleod, BloodPhilia, grawity, Sathya Mar 20 '11 at 15:11

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.

2  
It doesn't crash a properly configured Linux - it just uses up the processes of the current user (which you really should limit for all but root) –  Majenko Mar 20 '11 at 9:05
3  
Also, for all those who are reading this: DO NOT RUN THIS COMMAND. –  Wuffers Mar 20 '11 at 14:28

4 Answers 4

up vote 7 down vote accepted

This is called a fork bomb.

share|improve this answer

The command defines a function named :, which, when called, spawns two copies of itself in the background and exits. Those two copies do the same, resulting in a huge amount of processes in just a second, continuing indefinitely.

Below is exactly the same function but with a more readable name:

foo() {
    foo | foo &
}

foo
share|improve this answer
    
can u give a bit more explanation to decipher :(){ :|:& };: –  darthvader Mar 20 '11 at 8:39
3  
@iJeeves: I did. It's in the post. –  grawity Mar 20 '11 at 8:40
    
Where he writes foo replace it with : –  adamo Mar 20 '11 at 13:35

Technically speaking the system has not crashed. A system crash produces an exit with errors. It neither has hanged. This would imply that the system is doing something and has not returned. In the particular case it is working properly. It just takes too long to respond because a computer realization has finite resources. Hence infinite processes and finite resources result in infinite time to respond.

share|improve this answer
    
could you please explain the downvote? I am just arguing that this is in fact the wrong question because as noted above having restricted the user resources this would not produce any problem. Hence this is not intrinsic to the linux / unix system but a result of mal-administration. –  g24l Mar 20 '11 at 14:28

It forks processes to background endlessly. After a while, there is too many processes, each taking small amount of system resources.

share|improve this answer

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