Hope this isn't a stupid question but I did a search and couldn't find the answer. I am using ubuntu 8.04 and have a separate home partition. While setting it up I had a few failures and was left with several directories containing many hidden files which I can't seem to delete. The man pages for 'rm' didn't seem to provide the answer either.

Is there a flag or escape sequence that will allow 'rm' to delete these files?

Dan

OdinnBurkni

03-17-2010 06:17 PM

deleting

Hi.
Not sure if it works in Ubuntu but in CentOS I've used rm -rf to delete files and directories without warnings.

pixellany

03-17-2010 06:28 PM

WARNING: using "rm -rf" could be like killing ants with a pile driver.....

First, can you see the files you want to delete? "ls -a" should show all hidden files.

Second, check permissions. Or just su to root (or use sudo in Ubuntu and its progeny)

If all is in order and you still cannot delete something, then "rm -rf directoryname" can do the trick. First, be absolutely sure that you know what is in that directory.

Before doing any of this, having all you data backed up is always a nice touch........:)

dbuehler

03-17-2010 06:53 PM

Hey, thanks for the help. I managed to delete the directories using 'rm -rf directory_name'.

I had tried 'rm -rf *" from within the directory but had no luck.

I am still not sure why I couldn't delete them them that way but, at least they are gone now.

OdinnBurkni

03-18-2010 03:49 AM

Warning !!!

pixellany your absolutely right, it's risky and should not be done unless you're sure what you're doing. My mistake was to take for granted that the user knew what he was doing and therefore I provided this suggestion. What I should have done was to warn him first and then provide the solution. Thank you for the comment, I'll be more careful in the future.

kingston

03-18-2010 04:06 AM

rm -rf * does not delete your hidden direcotories. why dont you try with "rm -rf .*"? After executing this, it may give the the error rm: cannot remove `.' or `..'

dbuehler

03-18-2010 06:39 AM

(Solved) How to delete multiple hidden files

kingston said:
"why dont you try with "rm -rf .*"?"

I did try that but it did not work. Like I said, I am not sure why.

Also, this is my first post to this forum and it wasn't obvious to me how to mark this thread as solved. Hopefully, putting it in the title block will work.

repo

03-18-2010 06:42 AM

Quote:

it wasn't obvious to me how to mark this thread as solved

You can use the thread tools

catkin

03-18-2010 07:09 AM

Quote:

Originally Posted by dbuehler
(Post 3903044)

kingston said:
"why dont you try with "rm -rf .*"?"

I did try that but it did not work. Like I said, I am not sure why.

You wrote that you tried rm -f * and kingston suggested using a dot in front the star.