• gnutrino@programming.dev
        link
        fedilink
        English
        arrow-up
        29
        ·
        edit-2
        11 hours ago

        So, it uses the fact that bash allows functions with non-alphanumeric names, in this case it defines a function called :. If we rename that to, for example bomb it becomes a little clearer:

        bomb(){ bomb | bomb& };bomb

        This defines a function that calls itself piped into a version of itself in a separate, background, process (that’s what the & does) and then calls that function. Calling itself means the function never ends (it’s essentially a recursive version of an infinite loop) and the extra background process that is created each time it’s called means that it just keeps exponentially creating new processes that don’t exit and each of which infinitely forks off more processes until the OS runs out of resources (unless you use ulimit to set per-session/per-user process limits - this may even be done by default on some distros these days, it’s been a while since I looked)

        • skulblaka@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          20
          ·
          12 hours ago

          Thank you, this is the first time I’ve ever actually seen the fork bomb described in a way that makes sense. I knew what it did but I didn’t understand how the input string caused it, it was effectively just a magic rune of crashing to me. This is a great explanation.

      • AzuraTheSpellkissed@lemmy.blahaj.zone
        link
        fedilink
        English
        arrow-up
        3
        ·
        8 hours ago

        In easier terms: it’s a script function, which when executed starts itself twice (recursion), leading to an infinite loop that takes up resources, and - in the worst case - causes a freeze or crash. Due to its cryptic code, an unknowing user might not know what they get themselves into when they run it.

      • atropa@piefed.social
        link
        fedilink
        English
        arrow-up
        27
        ·
        14 hours ago

        Casual here ,

        It is a process that copies and splits itself until all the computer’s processing power is used up, causing it to crash.

        Test it at your own risk

        Usually, you can restart without problems afterwards .

        I did this 10 years ago on a Mint computer.

        This is the fun part of your journey with Linux , you are the boss of your computer.

        • Pat_Riot@lemmy.today
          link
          fedilink
          English
          arrow-up
          9
          ·
          14 hours ago

          Sounds awful. Since I switched to Mint my computer has only crashed when I got out of hand with Blender, I can’t see myself doing it on purpose.

          • ozymandias@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            10
            ·
            14 hours ago

            People do it as a stress test of their system. A goodly OS should be able to stop it before it crashes the system, otherwise it won’t cause much damage (depends on what else you’re doing when it crashes)

          • atropa@piefed.social
            link
            fedilink
            English
            arrow-up
            5
            ·
            14 hours ago

            It was a nice experience, part of the learning process, discover your limits and go beyond them, everything at your own pace.

            Make sure you always have multiple external backups, check them for errors as well.

            Currently I am reading up on off grid communication mechcore and reticulum

            • Pat_Riot@lemmy.today
              link
              fedilink
              English
              arrow-up
              3
              ·
              10 hours ago

              All my computer is for is drawing pictures, making noise and occasionally doing internet stuff that’s too obnoxious to do from my phone. I don’t game or code or torrent. Really mostly just Blender and PrusaSlicer.

      • niartenyaw@midwest.social
        link
        fedilink
        English
        arrow-up
        3
        ·
        14 hours ago

        it creates a process that makes copies of itself. then those copies make copies… until your computer runs out of resources and crashes