LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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, 07:02 PM   #1
dbuehler
LQ Newbie
 
Registered: Jan 2010
Posts: 13

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, 07:17 PM   #2
OdinnBurkni
Member
 
Registered: Feb 2007
Location: Iceland
Distribution: Fedora 14, CentOS, FreeNAS
Posts: 126

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, 07:28 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
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, 07:53 PM   #4
dbuehler
LQ Newbie
 
Registered: Jan 2010
Posts: 13

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, 04:49 AM   #5
OdinnBurkni
Member
 
Registered: Feb 2007
Location: Iceland
Distribution: Fedora 14, CentOS, FreeNAS
Posts: 126

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, 05:06 AM   #6
kingston
Member
 
Registered: Mar 2008
Location: Bengaluru, India
Distribution: RHEL 5.5, Solaris 5.10
Posts: 193
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, 07:39 AM   #7
dbuehler
LQ Newbie
 
Registered: Jan 2010
Posts: 13

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, 07:42 AM   #8
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Linux Mint
Posts: 8,516

Rep: Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896Reputation: 896
Quote:
it wasn't obvious to me how to mark this thread as solved
You can use the thread tools
 
Old 03-18-2010, 08:09 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 10: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-03-2008 12:01 AM
Delete a single E-mail / multiple mbox files mgichoga Debian 0 02-18-2007 09:42 PM
How to delete hidden files??? kabucek Linux - Distributions 5 08-28-2006 12:21 AM
delete multiple files ashley75 Linux - General 1 05-02-2006 02:32 PM


All times are GMT -5. The time now is 05:36 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration