LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 02-09-2010, 04:08 PM   #16
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,275

Rep: Reputation: 126Reputation: 126

Quote:
Originally Posted by MTK358 View Post
I'm so confused

Howcome rm -rf .. doesn't delete the parent but rm -rf * does?
Where did you get the idea that "rm -rf *" does delete the parent?
 
Old 02-09-2010, 04:43 PM   #17
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Original Poster
Rep: Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720
Quote:
Originally Posted by Quakeboy02 View Post
Where did you get the idea that "rm -rf *" does delete the parent?
I hear so many stories of people accidentally typing "rf -rf *" as root and deleting the entire file structure.
 
Old 02-09-2010, 05:10 PM   #18
halborr
Member
 
Registered: Aug 2009
Posts: 112

Rep: Reputation: 18
Quote:
Originally Posted by MTK358 View Post
I hear so many stories of people accidentally typing "rf -rf *" as root and deleting the entire file structure.
Could it be "rm -rf /*" or "rm -rf /" you're thinking of?
 
Old 02-09-2010, 05:12 PM   #19
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Quote:
I hear so many stories of people accidentally typing "rm -rf *" as root and deleting the entire file structure.
Usually it's this mistake that causes the fatal error:

Code:
rm -rf / path/to/directory
Notice the accidental space between the "/" and "path"

So this is equivalent to rm -rf / and it probably never gets as far as
rm: cannot remove "path/to directory" : No such file or directory

So this is a bad thing to type as root. Used as your username, it'll "just" remove all the entries under your /home/username, and any files you may have in /tmp, so you are wiped out, but the system will still continue to function normally ( root can login, and re-create your account, if not the data it held ).

Backups are important.

I once hosed my system with (as root)
Code:
cd /home/tred/oldhome-with different-UID:GID
chown -R tred:tred *
# Noticed the .files hadn't been chown'd, so..
chown -R tred:tred .*
Thought it was taking rather too long. So I <CTRL>-C'd it.
System broken.

Can you work out why?

[Reinstall required (but no data lost). Lesson learnt ]
 
Old 02-09-2010, 08:20 PM   #20
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Original Poster
Rep: Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720Reputation: 720
Quote:
Originally Posted by tredegar View Post
Usually it's this mistake that causes the fatal error:

Code:
rm -rf / path/to/directory
Notice the accidental space between the "/" and "path"

So this is equivalent to rm -rf / and it probably never gets as far as
rm: cannot remove "path/to directory" : No such file or directory
No, I'm pretty sure it was rm -rf *

Quote:
Originally Posted by tredegar View Post
I once hosed my system with (as root)
Code:
cd /home/tred/oldhome-with different-UID:GID
chown -R tred:tred *
# Noticed the .files hadn't been chown'd, so..
chown -R tred:tred .*
Thought it was taking rather too long. So I <CTRL>-C'd it.
System broken.

Can you work out why?

[Reinstall required (but no data lost). Lesson learnt ]
No, I looked at it for a few minutes and couldn't figure it out.

Though I'm suspecting it might have something to do with the space in the filename.
 
  


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
Deleting files... Skillz Linux - General 7 10-14-2009 01:40 AM
Probably a simple sed questions for deleting lines... oldcarguy85 Linux - General 4 03-28-2008 08:11 AM
About deleting a files combilli Linux - Newbie 1 01-09-2007 11:54 PM
Deleting old files shiroh_1982 Linux - Newbie 2 06-21-2006 08:26 AM
Deleting files in C monil Programming 4 03-13-2005 11:33 AM


All times are GMT -5. The time now is 01:44 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration