My 2 paisas

rm -rf *

Posted on: December 11, 2009

I just got an idea of trying out the command rm -rf * in a virtual system. I had thought of creating a new domU in xen server in the office and then testing in it. However I just tried to switch on my Desktop which had been shut since last week due to some problem with my HDD. Strangely when I started the desktop, the BIOS detected my HDD and it booted into ubuntu. Now this made my expiriment lot more easier because now all I had to do was take a backup of the VM image and then boot using the image in qemu.

After booting up I started a screen and tried the command
rm -rf /
I got an error saying that “/” could not be deleted.

Then I tried the command
cd /; rm -rf *

and then it started deleting all the files in my filesystem. I went to another screen and tried the command “ls”. It told me that “ls” command not found. Then I tried various commands, but none of them worked, except echo and cd. I dont know why these didnt get deleted.

At last I was left with following file structure:
notice:/# cd
dev/ home/ lib/ proc/ .rnd sys/ var/

When I just press Tab twice, I get the following output:

notice:/#
: } case continue elif export getopts kill popd select then ulimit
! alias cd declare else false hash l printf set time umask
./ bg cdcgi dirs enable fc help let pushd shift times unalias
[ bind cdtmpl disown esac fg history ll pwd shopt trap unset
[[ break command do eval fi if local read source true until
]] builtin compgen done exec for in logout readonly suspend type wait
{ caller complete echo exit function jobs ls return test typeset while

Though this would be a very stupid thing to do in any circumstances, I didnt loose anything as I was just testing it on a VM. However the importent question still remains that is there any way to recover fmo here?

Advertisements
Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Links that I liked to save

Blog Stats

  • 44,529 hits
%d bloggers like this: