Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Bash fork bomb syntax meaning

    Not that I want to actually do this, but what exactly does

    :\(){ :\|:& };:

    *do* to kick off a fork bomb? Just trying to better understand. I've escaped out a couple characters to prevent them from resolving as smiley faces in my post, but you get the idea of what I'm asking.

    Last edited by pgymjp; 11-20-2008 at 06:10 PM. Reason: clarification

  2. #2
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    I don't think those backslashes should be there,they're just escape characters.

    The colon is an alias for the true command. This is creating a function that splits off and runs itself again. By running asynchronously it continues to multiply at a geometric rate until all of the capacity of the machine is consumed. In modern systems this is prevented through use of ulimit which limits how many processes a user can have.

  3. #3
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    CA, but from N.Ireland
    Means that you're defining a function, and the function definition is between the curly braces.

    The function definition,
    , means that the function first calls itself, and then passes the output to another version of itself, which is then backgrounded (that's what the & does).

    After the function definition, the function is then called by using it's name, :.

    The following,
    forkbomb(){forkbomb|forkbomb&}; forkbomb
    would do the same thing except I've called the function "forkbomb", instead of the much harder to read ":".
    Last edited by smolloy; 11-20-2008 at 08:27 PM.
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

  4. $spacer_open
  5. #4

    Cool Fork bomb works like a champ

    Thanks. Really works great when run by root. Now I have to break out the big hammer to get my AIX box back.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts