# accidental sudo rm /* (!!)



## rainstorm (Jun 17, 2010)

Brand new macbook pro, (snow leopard 10.6).

Accidentally typed sudo rm * /* [I was trying for rm */*]

I *think* I still have the directories which should be in /

but I've clearly deleted some stuff, because I now don't seem to have any admin rights....

Does anyone know what I can have deleted?


----------



## DeltaMac (Jun 17, 2010)

'Accidental' wild-cards are the worst kind, eh?

We can see what you did type - but what exactly were you originally trying to delete? (and on a new system, too?)
Neither are good choices for a noob, sir!

You succeeded in removing most everything, so you can try restarting to see what you did...

Insert your restore DVD, and restart while holding the letter C. And, reinstall your system.


----------



## rainstorm (Jun 17, 2010)

I was trying to remove an unpacked tarball which I'd moved from /usr/local/src. It has somehow got the root permission 'stuck' to it. 

I appreciate that this makes me an idiot....

it looks like my /etc has gone. (why has this gone? isn't /etc a folder?)

Reinstalling the system - any risks? (apart from undoing all the things I've added over the last 24hours?)


----------



## MisterMe (Jun 17, 2010)

rainstorm said:


> ...
> 
> Reinstalling the system - any risks? ...


Do you mean is it a worse risk than typing sudo rm /*? No.


----------



## DeltaMac (Jun 17, 2010)

Unpacked tarball?
Aren't there plenty of those off (and on) the Gulf coast? (sorry, couldn't let that pass)

Why would you use wild cards to remove one file? (sigh...)


----------



## rainstorm (Jun 17, 2010)

The tarball (a g77 compiler....) , when unpacked, made *many* subdirectories.  And I foolishly thought that rm */* was safer than doing an rm -r..... 

Comparing it to another mac, it looks like all I actually deleted was the mach_kernel!

I'm mid-way through installing the OS again from the disk, and I have a list of the packages I'd installed. I think that probably it was best to do this on my first full day with a mac - less to loose!


----------



## MisterMe (Jun 17, 2010)

rainstorm said:


> The tarball (a g77 compiler....) , ...


There are much better ways to install g77 and other compilers on your Mac. FWIW, *g77* and *g95* have been supplanted by *gfortran*. This and many more UNIX tools can easily be installed using *Fink* or *MacPorts*.


----------



## rainstorm (Jun 17, 2010)

Thank you! I'd been installing software using fink; but I need a particular (slightly old but patched) g77 for some nasty old legacy code (or a coding pixie to fix the legacy code) - we've tried gfortran before and it just doesn't cut it. I'd got gfortran without any trouble using fink (actually the fink commander front end). 

Whereas now, the first thing that I have done is alias rm to rm -i. And resolved to pay more attention when deleting things!

I am now a cautionary tale to myself!


----------



## Whitehill (Jun 18, 2010)

rainstorm said:


> it looks like my /etc has gone. (why has this gone? isn't /etc a folder?)



No.  It's a symbolic link to /private/etc.


----------



## Mikuro (Jun 18, 2010)

Well, at least you didn't have -r set. So what you did was delete all files (not directories) in both your current directory and in /. The only system FILES in / are mach_kernel and some symbolic links. /tmp and /etc point to /private/tmp and /private/etc. At least on my Snow Leopard system they do.


----------



## quaterziomo (Oct 2, 2010)

Hi All, 
New to the Forum and the Leopard system. Misunderstanding how to delete files using Terminal, I did the following two mistakes: 
typed 

sudo rm -rf

(asks for password, which I provided)

Here, nothing seemed to happen. Terminal went to the next line 
[USERNAME]users-Macbook-Pro:~[USERNAME]


I also did write down sudo rm -R and hit enter. 


I don't see any of my files deleted, but I am not sure whether I deleted some system files. 

My hope is that since I did not specify any directory in either of the two commands above, the system did not delete a file. But I am not sure? 

Any idea as to what I should do, or whether I should do anything at all? 

Thanks, and hi again


----------



## jbarley (Oct 2, 2010)

quaterziomo said:


> Any idea as to what I should do, or whether I should do anything at all?
> Thanks, and hi again



Yes, for starters stay away from 'sudo' and the Terminal window, at least until you have a better handle on OS X.


----------

