4

Possible Duplicate:
What does this cryptic bash command mean?

Why this command crashes Linux?

:(){ :|:& };: 
softwarematter
  • 3,949
  • 21
  • 63
  • 88
  • 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 09:05
  • 4
    Also, for all those who are reading this: ***DO NOT RUN THIS COMMAND***. – Wuffers Mar 20 '11 at 14:28

4 Answers4

20

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
u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
7

This is called a fork bomb.

SiggyF
  • 276
  • 2
  • 5
3

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

Olli
  • 7,571
  • 3
  • 34
  • 47
3

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.

g24l
  • 929
  • 5
  • 8
  • 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