[TUHS] rm command

Ralph Corderoy ralph at inputplus.co.uk
Thu Apr 26 08:09:16 AEST 2018


Hi Bill,

> I think it’s a bit more interesting to uncover why rm does not remove
> directories by default thereby obviating the need for rmdir

Well, I'd guess it's: rm just does a single unlink to decrement an
inode's reference count by one, actually increment it since they were
negative, whereas rmdir on an empty directory needs to do two
decrements, one for its directory entry in the parent, and one for `..'.

(I think hard links could apply to directories in the early days, until
it made things too awkward, e.g. du(1) and cycles.)

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy



More information about the TUHS mailing list