8

I admit it is a homework but I am lost in explaining the following command line:

WARNING: This is a so called FORK BOMB! This command line can and will crash your pc by consuming all RAM and CPU (trust me, I tried it...)

:(){ :|:& };:

As I know that I should do it alone here is what I have so far (searching for these chars is very discouraging).

  1. The pipe enables to concatenate some commands together so that the first output is used by the second as input.
  2. The & is to run a command in the background (basically used to start something from a shell which shouldn't be blocked by the command)

I guess that : is to fork? But here I am totally lost! I am willing to learn, so maybe someone have a good resource where I can read about that?

3
  • @kkp: isn't a situation where your system is not responding a similar to a crash? The solution to fix it is the same: hard reset the system Jun 8, 2011 at 18:01
  • Yeah..you are right.
    – samarasa
    Jun 8, 2011 at 18:03
  • FORKBOOOOOMB :D Jun 8, 2011 at 22:54

1 Answer 1

14
:()      # define ':' -- whenever we say ':', do this:
{        # beginning of what to do when we say ':'
    :    # load another copy of the ':' function into memory...
    |    # ...and pipe its output to...
    :    # ...another copy of ':' function, which has to be loaded into memory
         # (therefore, ':|:' simply gets two copies of ':' loaded whenever ':' is called)
    &    # disown the functions -- if the first ':' is killed,
         #     all of the functions that it has started should NOT be auto-killed
}        # end of what to do when we say ':'
;        # Having defined ':', we should now...
:        # ...call ':', initiating a chain-reaction: each ':' will start two more.

Source: Forkbombs on Wikipedia

5
  • thanks... it sounds pretty evil! Didn't know that you can define a method this way. very interesting Jun 8, 2011 at 18:02
  • could you tell me how you found that wikipedia article? I tried to but didn't succeed... Jun 8, 2011 at 18:14
  • I already knew what to search for ;)
    – Egil
    Jun 8, 2011 at 18:17
  • 2
    Ok, so you are an evil bad hacker :) thanks anyway! helped me a lot Jun 8, 2011 at 18:18
  • Most of us who have browsed the Ubuntu forums have been warned many times about running forkbombs or sudo rm rf you know the rest etc... Dunno if that's where Egil got it from though :P Jun 8, 2011 at 22:55

You must log in to answer this question.

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