LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-17-2010, 06:02 PM   #1
dbuehler
LQ Newbie
 
Registered: Jan 2010
Posts: 18

Rep: Reputation: 0
How to delete multiple hidden files


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
 
Old 03-17-2010, 06:17 PM   #2
OdinnBurkni
Member
 
Registered: Feb 2007
Location: Iceland
Distribution: Fedora 14, CentOS, FreeNAS
Posts: 127

Rep: Reputation: 20
deleting

Hi.
Not sure if it works in Ubuntu but in CentOS I've used rm -rf to delete files and directories without warnings.
 
Old 03-17-2010, 06:28 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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........
 
1 members found this post helpful.
Old 03-17-2010, 06:53 PM   #4
dbuehler
LQ Newbie
 
Registered: Jan 2010
Posts: 18

Original Poster
Rep: Reputation: 0
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.
 
Old 03-18-2010, 03:49 AM   #5
OdinnBurkni
Member
 
Registered: Feb 2007
Location: Iceland
Distribution: Fedora 14, CentOS, FreeNAS
Posts: 127

Rep: Reputation: 20
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.
 
Old 03-18-2010, 04:06 AM   #6
kingston
Member
 
Registered: Mar 2008
Location: Bengaluru, India
Distribution: RHEL 5.5, Solaris 5.10
Posts: 215
Blog Entries: 1

Rep: Reputation: 21
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 `..'
 
Old 03-18-2010, 06:39 AM   #7
dbuehler
LQ Newbie
 
Registered: Jan 2010
Posts: 18

Original Poster
Rep: Reputation: 0
(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.
 
Old 03-18-2010, 06:42 AM   #8
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
it wasn't obvious to me how to mark this thread as solved
You can use the thread tools
 
Old 03-18-2010, 07:09 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by dbuehler View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete multiple hidden files Beresford Linux - General 3 06-27-2008 09:44 AM
how do I write a script using sed to delete the first and last line in multiple files Rikki D Programming 4 05-02-2008 11:01 PM
Delete a single E-mail / multiple mbox files mgichoga Debian 0 02-18-2007 08:42 PM
How to delete hidden files??? kabucek Linux - Distributions 5 08-27-2006 11:21 PM
delete multiple files ashley75 Linux - General 1 05-02-2006 01:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration