New answers tagged

4

This is because rm was never meant to delete directories at all. Originally rm didn't support -r and users had only 1 option: To delete all files in a dir with rm and after that to remove (the now empty) dir with rmdir Obviously working like this is very annoying so -r was implemented to fix this problem. But if rm /some/empty/dir would start working than ...


2

From man rm: By default, rm does not remove directories. Use the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents. I'll take a guess here: It's a safety feature that you do not delete directories with files in there without realizing. I assume rm would not check if a directory had content in first place (...


0

The logic is similar to that of a house: The owner or tenant decides which guests to throw out, no matter who owns the guests. Also, the evicted guest that is welcome in another house (has another hardlink in someone else's directory) will not freeze to death outside.


Top 50 recent answers are included