Big mistaking extracting files, how to "undo" it?

James McKenzie jjmckenzie51 at earthlink.net
Sun Jan 30 22:45:15 UTC 2005


Matthew Saltzman wrote:
> On Sun, 30 Jan 2005, James McKenzie wrote:
> 
>> Matthew Saltzman wrote:
>>
>>> On Sun, 30 Jan 2005, Leandro Melo wrote:
> 
> 
>>> "rm /usr/*" will delete only files in the directory /usr.  
>>> Directories will remain intact.  To recursively delete directories 
>>> and their contents, use "rm -r <path>".  If you are getting prompts 
>>> for every file, use "\rm /usr/*".  Read "man rm" carefully.
>>>
>>> FYI, here's the contents of my /usr/ dir:
>>>
>>> $ ls /usr
>>> bin  etc    include  kerberos  libexec  lost+found  share  tmp
>>> doc  games  java     lib       local    sbin        src    X11R6
>>>
>> If you were do delete the /usr directory, you will end up reinstalling 
>> Linux.
> 
> 
> Why?  There are usually no regular files in /usr (and the OP knew he had 
> none).  "rm *" removes only regular files in the current directory.  It 
> doesn't delete or descend directories.  Deleting directories requires 
> "rm -r".  (Sure, you do have to be careful, but if you don't do it 
> wrong, you won't be screwed.)

I've been the victim of a rm -rf * gone wrong.

I would be very careful when using the rm command in any directory which 
is required by the operating system.

However, you are right, rm * should only remove the files put there by 
the misuse of the unzip program.

I would definitely backup the subdirectories in the /usr directory 
before running the rm command, just in case something goes wrong.

-- 
James McKenzie




More information about the users mailing list