• neidu3@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 hour ago

    Short answer: Nothing

    Long answer: It is part of a command that deletes everything. The only thing missing is the argument specifying what to delete. Examples:

    rm -rf *
    rm -rf /some/directory
    

    It’s somewhat (in)famous because it’ll do so without asking for confirmation. The only exception is rm -rf / on a modern distro which will complain that you’re attempting to delete EVERYTHING on the system. In the olden days it’d just do it, but these days it tells you to add --no-preserve-root as well if you really wish to do so.

  • AstroLightz@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    9 hours ago

    You have it backwards.

    rm -fr /* removes the French language pack that comes preinstalled on your system.

    /j

  • remon@ani.social
    link
    fedilink
    arrow-up
    7
    ·
    12 hours ago

    It will delete everything in the directory after that, without asking for further confirmation.

    • 0xKeshara@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      8
      ·
      12 hours ago

      Unless it’s on /, where preserve-root should be kicking in, unless the bypass flag is used (can’t remember this one)

      • Havatra@lemmy.zip
        link
        fedilink
        English
        arrow-up
        4
        ·
        12 hours ago

        Not all systems have the preserve-root flag enforced, actually… I accidentally did the rm -rf / in a bash script (the variable for the path returned empty), and it irreversibly deleted a bunch of my system, including sudo and a big part of /etc, before I realized and did Ctrl+C. However the damage was done, rendering the system both unusable and unbootable. Fortunately I managed to recover some data, as the drive was not encrypted.

        Edit: Yes, like a fool I ran the script as sudo… I am now older and wiser.

        • 0xKeshara@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          1
          ·
          29 minutes ago

          What distro was this out of curiosity? As far as I’m aware preserve-root enforcement comes from upstream coreutils

    • Successful_Try543@feddit.org
      link
      fedilink
      arrow-up
      4
      arrow-down
      2
      ·
      11 hours ago

      No, it does nothing.

      $ mkdir test
      $ cd test
      ~/test$ touch 1 2 3 4 5
      ~/test$ rm -rf
      ~/test$ ls
      1  2  3  4  5
      

      If you dont specify the -f option, which among other things tells rm to be quiet, it throws an error:

      $ rm -r
      rm: missing operand
      Try 'rm --help' for more information.
      
      • remon@ani.social
        link
        fedilink
        arrow-up
        2
        arrow-down
        1
        ·
        11 hours ago

        Because you’re using it on nothing.

        $ mkdir test
        $ cd test
        ~/test$ touch 1 2 3 4 5
        ~/test$ cd ..
        $ rm -rf test
        $ ls
        

        No more test folder.

          • remon@ani.social
            link
            fedilink
            arrow-up
            3
            arrow-down
            1
            ·
            11 hours ago

            What are you talking about? The does exactly what I said it does.

            It only does nothing for you because you used it incorrectly (in the wrong folder without the required argument).