4

Possible Duplicate:
What does this cryptic bash command mean?

Why this command crashes Linux?

:(){ :|:& };: 
2
  • 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, 2011 at 9:05
  • 4
    Also, for all those who are reading this: DO NOT RUN THIS COMMAND.
    – Wuffers
    Mar 20, 2011 at 14:28

4 Answers 4

7

This is called a fork bomb.

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
3
  • can u give a bit more explanation to decipher :(){ :|:& };: Mar 20, 2011 at 8:39
  • 3
    @iJeeves: I did. It's in the post. Mar 20, 2011 at 8:40
  • Where he writes foo replace it with :
    – adamo
    Mar 20, 2011 at 13:35
3

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

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.

1
  • 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, 2011 at 14:28

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