[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug: rm command
From: |
Bob Proulx |
Subject: |
Re: bug: rm command |
Date: |
Wed, 13 Nov 2002 10:32:47 -0700 |
User-agent: |
Mutt/1.4i |
> according to man page of 'rm' command -d option can be used to
> unlink directory (by su).
> -d, --directory unlink directory, even if non-empty (super-user only)
>
> If I specify -d option for a removing a directory, it gives me an error
>
> # rm -d <dir>
> rm: cannot unlink `<dir>': Is a directory
>
> I have to specify -R option to remove a directory.
>
> Is this behavior correct? what's the of -d option?
Not a full answer to your question. But a tidbit.
The -[rR] option is probably what you want. That recursively removes a
directory.
The -d option "unlinks" a directory which has a very specific
behavior. That leaves the disk blocks dangling and does not free up
disk space. Normally those blocks would only be recovered upon an
fsck of the filesystem when a full garbage collection can occur.
Normally one would link a directory someplace else first before
unlinking it from the original location so as to keep the end result
consistent. Or one would unlink to correct for having a directory
multiply linked to mutiple locations.
Manually linking and unlinking directories is rarely, rarely, rarely
ever needed or useful today. But in days past manual fixing of
filesystem problems was more common. Unless you really know what you
are doing you should avoid "unlinking" a directory. Or "linking" a
directory either.
Probably, don't know, the error is resulting because modern filesystem
are not supporting that old time capability. I know if I were writing
a filesystem today I would avoid giving that capability. But the tool
does not know that and gives it a try and reports the failure.
Bob
--
Please follow up to the list and not to me privately unless it is
personal.