rm -fr /
In a continuing reference series of unix newbie tricks, apparently some of the oldest tricks in the book still work…
Ethan and Sasha are technicians under me at work. I’m fixing it at no charge to the client later this week. I was in a sales meeting during this exchange.
Ethan: how do i check the amount of free space on a hard drive in unix
Sasha: um
Sasha: shit
Ethan: come on
Sasha: I should know this
Ethan: you call yourself a h@x0r?
Sasha: no, I am just trying to remember how to
Sasha: df
Sasha: at a command prompt
Ethan: hahaha
Ethan: ok
Ethan: so how do i free up space
Ethan: what’s the spacemonger equivalent in unix
Ethan: oh wait
Ethan: unix doesn’t have useful utilities like that
Sasha: cd /
Sasha: rm -rf /*
Sasha: no, do not do that
Ethan: why
Sasha: trust me
Sasha: don’t do that :P
Ethan: well what if i started
Ethan: and control C’d it
Sasha: then you will be re-installing unix on that machine
Ethan: ?
Sasha: that will do a recursive delete of everything on that machine
Ethan: dude
Ethan: i’ll kill you
Sasha: I told you not to
Ethan: 7 seconds later
Sasha: you are too fast on the draw
Sasha: tell me you did not do that
Ethan: oh man
Ethan: sad times
Sasha: wtf
Ethan: i did it for about 1 second
Sasha: we can only hope
Sasha: what machine?
Ethan: roflmao
Ethan: this is insane
Sasha: ?
Ethan: well i can’t log back into it
Ethan: a clients production spam filter server
Ethan: how do i make it so that email starts going to their exchange server
Sasha: um
Ethan: since this box is pwned
Ethan: it had run out of space
Ethan: 40 blocks free
Ethan: 100% used
Sasha: log into their router and change port 25
Sasha: and clear out /var
Sasha: /var is where mail and temp files are kept
Ethan: i can’t log into the spam assassin box anymore
Sasha: :banghead:
Ethan: tihs is why unix is bad
Sasha: the box will probably have to be rebuilt unless Grant can fix it
Ethan: non gui is bad
Sasha: yes
Sasha: yes
Sasha: and asking me advanced *nix questions is bad
Ethan: waiting 7 seconds after telling me to do the unix equivalent of format c: before telling me not to is bad
Sasha: I’m sorry I was typing slow
Sasha: (but if you know how to log into a unix box and know how to do an “ls” then you should realize that was a bad idea )
Ethan: ls is the only command i know
Ethan: well, ls
Ethan: uptime
Ethan: shutdown
Ethan: cd
Sasha: now you know 2 more
Sasha: df
Ethan: and man
Sasha: and rm (remove)
Ethan: i love how it doesn’t prompt you at all
Sasha: that’s where the -rf come in
Sasha: you were logged in as root?
Ethan: that’s the only way to do anything on there
Ethan: what’s the rf for
Sasha: recursive and -f: Attempt to remove the files without prompting for confirmation, regardless of the file’s permissions. If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error. The -f option overrides any previous -i options.
Ethan: bastard
Ethan: I’ll kill you
Sasha: please tell me you are joking
Ethan: joking about what
Ethan: the killing
Sasha: no
Ethan: or that i did that command
Sasha: that you ran that command
Ethan: oh it ran alright
Ethan: for 1/2 a second
Ethan: apparently that was enough
Sasha: it can probably be fixed
Sasha: though if it was out of space, might be a good idea to rebuild anyway
Ethan: it may have just had a bunch of log files or somethign
Sasha: get in touch with Grant yet?
Ethan: no
Ethan: sent him a text message
Sasha: ok, cool
Sasha: remember: rm -rf /* is bad, mkay? it does NOT “Read Mail -Really Fast”
Ethan: hahahahahaha
Ethan: he got quite a laugh out of that
Ethan: never assume I know anything about unix/linux
Sasha: lol, so you’re talking to Grant?
Ethan: i just did
Ethan: he thought it was funny
Sasha: and never assume I know what I’m talking about unix/linux
Sasha: :)
Ethan: well hey we fixed their original issue
Ethan: of not being able to get email
Ethan: and we freed up drive space too as you pointed out