Does rm -rf /* command at cygwin affects Windows systems?

2

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...

user1209133

Posted 2012-05-01T04:39:30.923

Reputation: 23

4You'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. – None – 2012-05-01T04:41:43.400

1I'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 – 2012-05-01T18:58:18.600

Answers

2

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.

Fran

Posted 2012-05-01T04:39:30.923

Reputation: 4 774

I think it's C:\cygwin by default, but you specify it when you first install Cygwin. – Keith Thompson – 2012-05-01T19:38:58.510

4there 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 – 2012-05-02T01:54:26.767

barlop is right, rm would have got to /cygdrive and all the Windows drives underneath it at some point. – ak2 – 2012-05-02T04:19:06.590