Sudo rm -rf .

you are viewing a single comment's thread
view the rest of the comments
[–] 59 points 7 months ago (15 children)

DOS user detected! In linux you don't need *.*, you can just use *

  • source
  • hideshow 15 child comments
  • [–] 35 points 7 months ago (5 children)

    Maybe he wanted to remove only files with a dot in the name

  • source
  • parent
  • hideshow 5 child comments
  • [–] 10 points 7 months ago (4 children)

    And if he’s on / (root) on most common distros, there won’t be any dirs with . (dot) in their name. Unless this matches the dot from the cwd, in which case this is the same as “rm -rf /“? Now I’m curious, I don’t often perform operations on the cwd using dot.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 6 points 7 months ago (3 children)

    At least bash doesn't seem to match it...

    gregor@raspberrypi:~ $ ls
    bridge  navidrome  seed  traefik
    gregor@raspberrypi:~ $ ls *.*
    ls: cannot access '*.*': No such file or directory
    gregor@raspberrypi:~ $ cat *.*
    cat: '*.*': No such file or directory
    
  • source
  • parent
  • hideshow 3 child comments
  • [–] 2 points 7 months ago* (2 children)

    Right, so then if asterisk wildcards don’t match on . and .. then, in most common distros where there is no dot in any of the top level dirs in /, “rm -rf *.*” in the top level / dir is basically harmless and likely a noop.

    So OP is wrong.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 4 points 7 months ago (4 children)

    well, depending on your shell

  • source
  • parent
  • hideshow 4 child comments
  • [–] 5 points 7 months ago (3 children)

    Which shell interprets * as everything before extension?

  • source
  • parent
  • hideshow 3 child comments
  • [–] 7 points 7 months ago (2 children)

    Well I’m not necessarily commenting on the *.* but * will skip .files in bash.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 4 points 7 months ago (1 child)
  • [–] 2 points 7 months ago* (last edited 7 months ago)

    *.* will likely expect a file named *. and then delete any file globbed, but still leave dotfiles. At least in bash.

    In my shell it would just error at me and then I’d be mad fish doesn’t work like bash in this specific case

  • source
  • parent