▲ 126 ▼ when you notice that the rm command takes longer to run than expected (lemmy.world) submitted 10 months ago by SlizedOnion@lemmy.world to c/programmerhumor@lemmy.ml 20 comments fedilink hide all child comments 💀☠️
[–] deegeese@sopuli.xyz 8 points 10 months ago (3 children) sudo rm -r . / permalink fedilink source hideshow 3 child comments replies: [–] hddsx@lemmy.ca 10 points 10 months ago (2 children) Nobody deletes “./“. It’s far far more likely to be “/ tmp/file” Also, without the -f it will prompt you. Chances are, the meme is with -f The other possibility, though I haven’t tested it, is the working directory is / and they did “rm -rf .” Without first checking with pwd. I know that most OS will refuse to remove root without passing in a special flag nowadays. Only a few OS still respect you as sudo. permalink fedilink source parent hideshow 2 child comments replies: [–] T156@lemmy.world 4 points 10 months ago Though the check isn't very sophisticated, if memory serves. It more or less checks whether / is passed to rm -r. If you did something like rm -r $VAR/*, but didn't check to make sure that $VAR was set and not empty, it could still fire, since rm wouldn't see that root got passed, only a bunch of directories in root. permalink fedilink source parent [–] LunaChocken@programming.dev 1 point 10 months ago I always add rm flags AFTER the paths. So then I double check the path after adding the flags. permalink fedilink source parent
[–] hddsx@lemmy.ca 10 points 10 months ago (2 children) Nobody deletes “./“. It’s far far more likely to be “/ tmp/file” Also, without the -f it will prompt you. Chances are, the meme is with -f The other possibility, though I haven’t tested it, is the working directory is / and they did “rm -rf .” Without first checking with pwd. I know that most OS will refuse to remove root without passing in a special flag nowadays. Only a few OS still respect you as sudo. permalink fedilink source parent hideshow 2 child comments replies: [–] T156@lemmy.world 4 points 10 months ago Though the check isn't very sophisticated, if memory serves. It more or less checks whether / is passed to rm -r. If you did something like rm -r $VAR/*, but didn't check to make sure that $VAR was set and not empty, it could still fire, since rm wouldn't see that root got passed, only a bunch of directories in root. permalink fedilink source parent [–] LunaChocken@programming.dev 1 point 10 months ago I always add rm flags AFTER the paths. So then I double check the path after adding the flags. permalink fedilink source parent
[–] T156@lemmy.world 4 points 10 months ago Though the check isn't very sophisticated, if memory serves. It more or less checks whether / is passed to rm -r. If you did something like rm -r $VAR/*, but didn't check to make sure that $VAR was set and not empty, it could still fire, since rm wouldn't see that root got passed, only a bunch of directories in root. permalink fedilink source parent
[–] LunaChocken@programming.dev 1 point 10 months ago I always add rm flags AFTER the paths. So then I double check the path after adding the flags. permalink fedilink source parent