Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I did frequency mistake that rm -rf /* at cygwin console on Windows 7.

After a minute I realized what I typed. So I stopped the command by Ctrl-c.

I braced myself for re-installing Windows.

But Windows works fine even after rebooting. My documents, pictures, musics and other stuffs seems to be saved. It seems that I lost only just a cygwin directory.

  1. Is it just a luck (I terminated command before it got /cygdrive/c ) ? or

  2. cygwin's rm command has some kind of FOOL-proof architecture ?

If it is just a lucky then I must check twice...

share|improve this question

migrated from May 2 '12 at 1:26

This question came from our site for professional and enthusiast programmers.

You're probably lucky. The rm will go through in file-system order, and /cygdrive happened to be farther "down" the chain and rm didn't reach it before you killed it. It also helps that cygwin is by its nature fairly slow on filesystem operations, because it has to remap unix file semantics into Windows-style stuff. – Marc B May 1 '12 at 4:41
I've used rm -rf on a directory in MingW before and nearly deleted my entire C drive. Cygwin may be different but don't bet on it. – Andrea May 1 '12 at 18:58
up vote 2 down vote accepted

The directory named / in Cygwin is actually the directory where you installed Cygwin (e.g., C:\apps\cygwin). So you probably removed a chunk of your Cygwin install, but you didn't affect Windows. I would re-install Cygwin just to make sure it continues to work.

UPDATE: See the comment (below) about /cygdrive which leads to all local Windows drives. My above comment is not correct. The rm command in the question would have eventually started deleting Windows files.

share|improve this answer
I think it's C:\cygwin by default, but you specify it when you first install Cygwin. – Keith Thompson May 1 '12 at 19:38
there is c:\cygwin\cygdrive which is empty. But within cygwin, there is /cygdrive/c and the whole c drive. So if rm did the whole shabang it could in theory wipe all drives. – barlop May 2 '12 at 1:54
barlop is right, rm would have got to /cygdrive and all the Windows drives underneath it at some point. – ak2 May 2 '12 at 4:19
Thank you all for replies. – user1209133 May 2 '12 at 5:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .