this post was submitted on 13 Jul 2021
0 points (NaN% liked)
technology
23289 readers
37 users here now
On the road to fully automated luxury gay space communism.
Spreading Linux propaganda since 2020
- Ways to run Microsoft/Adobe and more on Linux
- The Ultimate FOSS Guide For Android
- Great libre software on Windows
- Hey you, the lib still using Chrome. Read this post!
Rules:
- 1. Obviously abide by the sitewide code of conduct. Bigotry will be met with an immediate ban
- 2. This community is about technology. Offtopic is permitted as long as it is kept in the comment sections
- 3. Although this is not /c/libre, FOSS related posting is tolerated, and even welcome in the case of effort posts
- 4. We believe technology should be liberating. As such, avoid promoting proprietary and/or bourgeois technology
- 5. Explanatory posts to correct the potential mistakes a comrade made in a post of their own are allowed, as long as they remain respectful
- 6. No crypto (Bitcoin, NFT, etc.) speculation, unless it is purely informative and not too cringe
- 7. Absolutely no tech bro shit. If you have a good opinion of Silicon Valley billionaires please manifest yourself so we can ban you.
founded 4 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
what's rm-rf?
rm
is the unix command for remove — it deletes files and directories.The
-r
flag, or--recursive
recursively traverses all the directories in the path file that you specify (so like if you have a directorystuff/
which has filesa.txt
,b.pdf
, and subdirectoryc/
thenrm -r stuff/
would remove both files as well asc/
and its contents.The
-f
flag, or--force
, does what it says on the tin: it deletes everything without prompting you or warning you about what it's going to delete.So it's possible to delete all the files on your system — including ones that the operating system needs to run — with
rm -rf /
. It's very hard to do on accident these days — usually you need superuser permissions (thesudo
insudo rm -rf /
) which requires you to enter your administrator password and to also pass the flag--no-preserve-root
which was created to keep people from deleting their whole system because someone named pigpoopballs69 on a random forum said to runsudo rm -rf /
So what would happen if you just did "rm stuff/" without the recursive flag? Shouldn't it work the same way and delete all of stuff/ contents?
also how do you do that code font thingy
rm stuff/
without the recursive flag fails with an error (rm: cannot remove 'stuff': Is a directory
) and doesn't remove anything. I'd guess the decision there was to have the least-destructive end result for ambiguous behavior, but I'm not entirely sure what the history is there, pretty sure that command is older than I am :)The code font thingy is the back tick character: `