this post was submitted on 16 Mar 2026
517 points (97.6% liked)

Programmer Humor

31023 readers
1133 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

Sudo rm -rf .

you are viewing a single comment's thread
view the rest of the comments
[–] db0@lemmy.dbzer0.com 61 points 1 month ago (4 children)

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

[–] lena@gregtech.eu 39 points 1 month ago (1 children)

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

[–] jaybone@lemmy.zip 9 points 1 month ago (1 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.

[–] lena@gregtech.eu 6 points 1 month ago (1 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
[–] jaybone@lemmy.zip 2 points 1 month ago* (last edited 1 month ago) (1 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.

[–] lena@gregtech.eu 1 points 1 month ago* (last edited 1 month ago) (1 children)

Technically, it says he's in the ~ directory, which would usually be /home/god, but even in there there aren't usually any directories/files with a dot.

[–] psud@aussie.zone 1 points 4 weeks ago

~ has many dot directories and files

[–] calango@programming.dev 12 points 1 month ago (1 children)

God programmed the universe into DOS

[–] jaybone@lemmy.zip 7 points 1 month ago

This explains a lot.

[–] Stupidmanager@lemmy.world 5 points 1 month ago* (last edited 1 month ago) (2 children)

Going to point out that not only is *.* unnecessary, but he’s in ~ (home) so assuming it even worked he just deleted his home.

maybe his $PS1 just happens to have a tilde in it

[–] Scrath@lemmy.dbzer0.com 1 points 1 month ago

Well, guess that's it for heaven

[–] prettybunnys@piefed.social 4 points 1 month ago (1 children)

well, depending on your shell

[–] db0@lemmy.dbzer0.com 5 points 1 month ago (1 children)

Which shell interprets * as everything before extension?

[–] prettybunnys@piefed.social 7 points 1 month ago (1 children)

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

[–] db0@lemmy.dbzer0.com 4 points 1 month ago (1 children)
[–] prettybunnys@piefed.social 2 points 1 month ago* (last edited 1 month 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