LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 09-20-2012, 10:53 AM   #1
isourabh.wadhwa
LQ Newbie
 
Registered: Jul 2010
Posts: 21

Rep: Reputation: 0
Cool somehow did "rm -rf /*" and restored it BUT ..


I accidentaly did

Code:
rm -rf /*
but cancelled it in 7 or 8 seconds .. after that i tried ls command but no use, /bin was gone .. cd was working .. I restored it through TSM(Tivoli storage manager) ..

now /bin is back .. i am able to make new sessions with server which i was not able to after "rm" command .. now I am not sure what else got deleted from this server .. is there any way to get a list of recently deleted files so I could restore these files ?
 
Old 09-20-2012, 10:57 AM   #2
Celyr
Member
 
Registered: Mar 2012
Location: Italy
Distribution: Slackware+Debian
Posts: 314

Rep: Reputation: 77
if /boot is untouched then only /bin is affected when you issue rm -rf /* it will delete your files in alphabetical order.
if /boot doesn't not exist then /dev is the next, then /etc, /home and so on.
But if /boot is still there you are lucky and I'm not sure you deserve it
 
1 members found this post helpful.
Old 09-20-2012, 11:02 AM   #3
isourabh.wadhwa
LQ Newbie
 
Registered: Jul 2010
Posts: 21

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Celyr View Post
if /boot is untouched then only /bin is affected when you issue rm -rf /* it will delete your files in alphabetical order.
if /boot doesn't not exist then /dev is the next, then /etc, /home and so on.
But if /boot is still there you are lucky and I'm not sure you deserve it
yeah, you're right, I dont deserve it .. and now my emotions >> Oh cr*p .. /boot is empty .. I am starting restore right now .. I guess I can scp /boot from similar linux server

am I right ?
 
Old 09-20-2012, 11:03 AM   #4
isourabh.wadhwa
LQ Newbie
 
Registered: Jul 2010
Posts: 21

Original Poster
Rep: Reputation: 0
Thank god .. I have backup of /boot too. I'll restore it ..
 
Old 09-20-2012, 11:07 AM   #5
Celyr
Member
 
Registered: Mar 2012
Location: Italy
Distribution: Slackware+Debian
Posts: 314

Rep: Reputation: 77
If dev is empty it's not a problem, a reboot should fix it.
But look at etc before. Anyway if /boot is still there it shouldn't have deleted anything in /dev
 
Old 09-20-2012, 11:16 AM   #6
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,383
Blog Entries: 1

Rep: Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100
I would suggest using a regular user, instead of root -- in the future.

Also, if you are extremely paranoid, as you should be as a system-admin, you can always make a small function that looks for 'rm -rf /' being executed and warns you, or just completely disallows you -- so you have to go through several hoops to make a mistake like that.
 
Old 09-20-2012, 11:23 AM   #7
isourabh.wadhwa
LQ Newbie
 
Registered: Jul 2010
Posts: 21

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Celyr View Post
If dev is empty it's not a problem, a reboot should fix it.
But look at etc before. Anyway if /boot is still there it shouldn't have deleted anything in /dev
/boot was emty but the directory itself was there .. I just did a restore and everything is back.

Fortunately, I handle both backup and Linux. ..
 
Old 09-20-2012, 11:25 AM   #8
isourabh.wadhwa
LQ Newbie
 
Registered: Jul 2010
Posts: 21

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by szboardstretcher View Post
I would suggest using a regular user, instead of root -- in the future.

Also, if you are extremely paranoid, as you should be as a system-admin, you can always make a small function that looks for 'rm -rf /' being executed and warns you, or just completely disallows you -- so you have to go through several hoops to make a mistake like that.
yeah true .. I guess tha would be best ..my intention was to delete all contents of my home directory on which some files had root permissions .. so i did
Code:
sudo rm -rf /*
instead of
Code:
sudo rm -rf ./*

yes .. I forgot the dot or i pressed it very lightly on the keyboard ..
 
Old 09-20-2012, 11:39 AM   #9
Celyr
Member
 
Registered: Mar 2012
Location: Italy
Distribution: Slackware+Debian
Posts: 314

Rep: Reputation: 77
Well, IMHO the real issue here is -rf, I've used to use those flags a lot as well and they are evil -f flag is evil, -r is pretty evil and all together are super evil. I've lost the habit of using them.
Also aliasing rm to rm -I is a good idea

Last edited by Celyr; 09-20-2012 at 11:42 AM.
 
Old 09-20-2012, 11:49 AM   #10
suicidaleggroll
Senior Member
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 3,144

Rep: Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108
I don't think there's a single experienced Linux admin here who hasn't done something similar when they were first starting out. Usually it results in a format and re-install of the OS, but since you had backups you may be able to recover. There's no better way to learn caution when using rm than accidentally doing something like this though.
 
Old 09-20-2012, 11:56 AM   #11
Celyr
Member
 
Registered: Mar 2012
Location: Italy
Distribution: Slackware+Debian
Posts: 314

Rep: Reputation: 77
ok, to be honest i did
Code:
rm -rf ~* instead of *~
and thus got delete /my/home/* instead of those damn .c~ files LOL
 
Old 09-20-2012, 04:31 PM   #12
linux_BSD
Member
 
Registered: Sep 2012
Posts: 47

Rep: Reputation: 4
I once did a rm -rf / on a linux install a long time ago in 2005. The difference is I did this on purpose to see what would happen. I was going to install another distro anyways.

When I ran rm -rf / it last until rm was no longer available i.e the bin directory was wipe out and rm no longer exited to continue the rest of the deletion.

Last edited by linux_BSD; 09-20-2012 at 04:33 PM.
 
Old 09-21-2012, 04:18 AM   #13
Celyr
Member
 
Registered: Mar 2012
Location: Italy
Distribution: Slackware+Debian
Posts: 314

Rep: Reputation: 77
Are you sure of this behavior? I think it should go on
 
Old 09-21-2012, 07:23 AM   #14
isourabh.wadhwa
LQ Newbie
 
Registered: Jul 2010
Posts: 21

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by linux_BSD View Post
I once did a rm -rf / on a linux install a long time ago in 2005. The difference is I did this on purpose to see what would happen. I was going to install another distro anyways.

When I ran rm -rf / it last until rm was no longer available i.e the bin directory was wipe out and rm no longer exited to continue the rest of the deletion.
No sir, it will continue deleting .. I made a new virtual machine at home just to see what happens and it never stops.

I dont know what was hte condition in 2005, but in 2012 rm will flat every directory's ass.
 
Old 09-21-2012, 08:11 AM   #15
segmentation_fault
Member
 
Registered: Sep 2008
Location: Ioannina, Greece
Distribution: Gentoo
Posts: 332

Rep: Reputation: 55
Maybe it depends if it's dynamically linked or compiled with static libs.
 
  


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
unpredictable "delete" "move to trash" or "cut" file menu option dorianrenato Linux - General 3 11-28-2011 07:41 PM
Make " restored" XP partition image boot for Linux (first)-XP dual-boot mowley Linux - Newbie 52 08-23-2010 03:00 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 11:18 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 09:31 AM


All times are GMT -5. The time now is 10:35 AM.

Main Menu
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