LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 03:08 PM   #16
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,410

Rep: Reputation: 141Reputation: 141

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, 03:43 PM   #17
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
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, 04: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, 04:12 PM   #19
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora40
Posts: 6,156

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
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, 07:20 PM   #20
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

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

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

All times are GMT -5. The time now is 10:37 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