[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fri, 4 Feb 2011 15:08:49 -0700
Tom Tijerina wrote:
> He ran man rm and it says at the top its for removing files OR
> directories. That is not correct as it does not give you any information
> for removing directories. I assumed it may be an option of some sort but
> I have not found it in the man page. Is this an oversight?
Of course the full documentation is available in the info pages. You
would be helping your friend out quite a bit if you gave him
instruction in accessing the info pages which tend to be more useful.
As to the man page the man page says:
This manual page documents the GNU version of rm. rm removes each
specified file. By default, it does not remove directories.
So you are correct that by default rm will not remove a directory.
$ mkdir testdir
$ rm testdir
rm: cannot remove `testdir': Is a directory
The man page then goes on to list the options.
-r, -R, --recursive
remove directories and their contents recursively
There is the information you missed. The rm command will remove
directories recursively when the -r option has been added.
$ mkdir -p testdir
$ ls -ldog testdir
drwxrwxr-x 2 4096 Feb 4 14:55 testdir
$ rm -r testdir
$ ls -ldog testdir
ls: cannot access testdir: No such file or directory
So it appears to me that the command and the documentation for it are
there. I think you just missed seeing it. Most GNU/Unix users are so
accustomed to useing 'rm -rf somethingsomething' that we don't often
look at the documentation for it anymore. But I believe it is there
okay just the same. :-)
For completeness here is the online standards documentation.
The -r option goes way back to the original Unix rm command forty
> If this is something positive credit should be given to Ron Flowers. He
> is the one who pointed it out to me.
You are building good karma by passing along the credit! Good job.
> Running Debian Lenny, GNU coreutils 8.5
Hmm... Not to cause a distraction here since it is completely
irrelevant but Lenny uses version 6.10 and Squeeze/Sid is 8.5 with the
expectation that Squeeze will release this weekend. And then Sid will
upgrade to 8.10 which was released just today. I think you crossed
your wires! :-)