user-avatar
Today is Friday
November 22, 2024

December 11, 2009

rm -rf *

by viggy — Categories: debian, linux, tech — Tags: , , Leave a comment

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?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>