top | item 15561987

Suicide Linux

272 points| brie22 | 8 years ago |qntm.org | reply

131 comments

order
[+] kingvash|8 years ago|reply
I've added a counter (of successful commands in a row) to my bashrc. I've seen it as high as 120.

  function promptCommand()
  {
    LAST_STATUS=$?
    # Set title of window to dir, then add new line to prompt.
    PS1='\[\e]0;\w\a\]\n'
    if [ $LAST_STATUS -eq 0 ]; then
      ((successes++))
      PS1+='\[\033[1;32m\][$successes]'
    else
      successes=0
      PS1+='\[\033[1;31m\][0 $LAST_STATUS]'
    fi  
    PS1+='\[\033[0;32m\] '
    PS1+='\w $(date +%H:%M) \$ \[\033[0m\]'
  }

  lastStatus=0
  successes=-1
  PROMPT_COMMAND="promptCommand"
My prompt:

  [0] /home/bar/g3 14:19 $ echo "boo"
  boo

  [1] /home/bar/g3 14:19 $
[+] kedean|8 years ago|reply
Man, I hope you don't use grep very often (by default it uses exit code 1 when it doesn't find anything).
[+] mondoshawan|8 years ago|reply
If you're looking for just mistypes, use status 128.
[+] lloeki|8 years ago|reply
> The reaction from the OS is actually rather underwhelming.

Somehow related, a coworker at a previous place unmounted some disks on an old AIX production box. It took him a solid minute to realise he had mistakenly unmounted / due to a typo (yes it was possible) as old processes with already opened files were happily serving stuff and only new attempts at opening files were beginning to produce errors.

Also, a similar interactive mishap in the heat of the action:

    somebox:~$ rm * .o
    rm: .o: No such file or directory
    somebox:~$ # ...
    somebox:~$ # *stares a prompt*
    somebox:~$ # Wait, what? _Please_ tell me those C files were versioned! (The answer was, obviously, "no")
[+] tech2|8 years ago|reply
Within the first year or so of having installed Linux (mid-90's), I made the mistake of accidentally deleting /etc (wrote a script to tidy /tmp at boot, but it hadn't cd'd correctly).

That was possibly the best unix/linux learning experience of my life. Rebuilding /etc sufficient to rescue my files I cared about before a reinstall. Rescue CDs weren't really a thing, USB was a new thing at the time, and I was on dial-up.

[+] peckrob|8 years ago|reply
A few months back I was wiping some old drives using a USB->SATA adapter plugged into an old Linux machine I keep around for experimenting on random things. Mostly because I could just leave it to run for however long it took. There were two drives in the machine, sda and sdb. So the drive came up as sdc.

So then I typed:

$ shred -n1 -v /dev/sda

Took me about 4 seconds to realize what I did before hitting Ctrl-C.

Then, I sighed. Considered whether I could save anything. Realized there wasn't anything on there worth saving, and reinstalled. :)

I'm usually much more cautious than that and I'm thankful it happened on a dumb test machine at home and not something important, but it was still a bummer and my first real sysadmin-type screw up. Mistakes happen, though. Even Linus once dialed his hard drive [0].

[0] https://liw.fi/linux-anecdotes/

[+] legohead|8 years ago|reply
A friend and I were working on a codebase and he did a similar typo:

rm *>o <-- kept shift held down while he pressed period

Been using "make clean" ever since.

[+] FullyFunctional|8 years ago|reply
Waay back in the day I was using crusty old shared Sun3 workstations. The keyboard was really sticky because, well, some students are pigs. I developed the habit of SLAMMING the Enter key on each command, until one day I was deleting backup files (rm *~) and my fingers grazed the delete button before striking Enter...
[+] pjc50|8 years ago|reply
Years ago, I forget how, I managed to wipe the partition table of a DOS PC. I ended up reconstructing it by hand using MS-DOS Debug and a copy of Peter Norton's book.

Another fun one: "killall" on Linux kills processes with names matching a string. "killall" on Solaris reboots the machine ...

[+] cryptonector|8 years ago|reply
On Illumos rm -rf / does nothing. POSIX says that removing / has undefined behavior, so the obviously smart (useful, user-friendly, GOOD) thing to do is to do nothing, as that fits "undefined behavior".
[+] lomnakkus|8 years ago|reply
That's quite funny... but ultimately futile. It doesn't say what happens if you say "DROP TABLE xyz<ENTER>WHERE...ohshit". (The <ENTER> bit is because you're used to doing that in your preferred SQL-DB editor.)

One should NEVER do anything non-scripted on a production system. ALWAYS enter it into a file and then do the "run-sql-from-a-file" command.

EDIT: Yes, I also realize that "rm -rf /" can theoretically happen if you have a bad variable substitution, but you MUST turn on the flags that cause your shell to error out instead of just substituting the empty string.

[+] jwilk|8 years ago|reply
It's actually required by POSIX to do nothing:

If either of the files dot or dot-dot are specified as the basename portion of an operand (that is, the final pathname component) or if an operand resolves to the root directory, rm shall write a diagnostic message to standard error and do nothing more with such operands.

Source: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm...

[+] Bromskloss|8 years ago|reply
> You know how sometimes if you mistype a filename in Bash, it corrects your spelling and runs the command anyway?

What? No, what's that about?

[+] Jedd|8 years ago|reply
> What? No, what's that about?

From TFA:

"Update 2015-04-18 -- I suppose I should finally clear this up: The autocorrect functionality I originally described here was a feature of the first Linux systems I ever used, so I assumed it was how every Linux system worked by default. Since then I've come to understand that it's a completely optional extra doodad."

[+] atdt|8 years ago|reply
There's the cdspell shopt: "If set, minor errors in the spelling of a directory component in a cd command will be corrected. The errors checked for are transposed characters, a missing character, and a character too many. If a correction is found, the corrected path is printed, and the command proceeds." (https://www.gnu.org/software/bash/manual/html_node/The-Shopt...)
[+] pierrec|8 years ago|reply
Yeah, I'm not aware of any distro that has this setting enabled by default. It's neat that it exists, though.
[+] kbenson|8 years ago|reply
Just have to mention, since I recognize the domain, that Sam Hughes has some excellent science fiction freely available in a serialized form here as well. Well worth investigating.
[+] odammit|8 years ago|reply
This is funny. I think I’ll stick with “thefuck” [1] though.

It would make a good prank to set up on someone that left their machine unlocked. Not sure if it’s more funny than changing their background to goatse.

[1] https://github.com/nvbn/thefuck

[+] bmiller2|8 years ago|reply
In all seriousness, what if it's a machine that no one should ever really be running commands on? This could be an effective, albeit naive, way to discourage undesirables in the system.
[+] DKnoll|8 years ago|reply
That is the most absurd approach to access control I have ever heard... but I like it.
[+] talyian|8 years ago|reply
Sadly, the machines I don't want people running commands on happen to be also the machines I don't want to rm -rf everything on as well.
[+] sova|8 years ago|reply
Computers already demand a level of precision that is hard for biological lifeforms to conform to. Now this. Not sure if I should laugh or cry.
[+] abtinf|8 years ago|reply
Perhaps a better name would be Roguelike Linux.
[+] tekstar|8 years ago|reply
a less destructive version of this is to install `sl` on your linux or mac.
[+] knappe|8 years ago|reply
Fun story:

I was in a sys admin class with a friend of mine and we both had access to the same machine to work on our assignments. I aliased each and every common command to `sl -f` on my friend's user as a prank (he never actually logged in as it turns out). However, my instructor, while projecting his screen to 150+ students (and recording) picked our box and my friend's user to use as an example. My instructor was flabbergasted for a few minutes and the class got a kick out of flying trains. :D

[+] KGIII|8 years ago|reply
That gets installed right after cowsay.

I have my priorities.

[+] Retr0spectrum|8 years ago|reply
Tip: If you ever trigger sl by mistake, and you're in a hurry, press Ctrl+Z instead of Ctrl+C (which doesn't work).
[+] isostatic|8 years ago|reply
I never type sl, but often type "gerp". I have an alias though.
[+] osxrand|8 years ago|reply
installed and checked the man page, hmm 'flies like the galaxy express 999' wonder what that is

$ ls -F

dammit!

$ sl -F

So I guess it's corrected my typos already :)

[+] dkresge|8 years ago|reply
reminds me my once time rather enjoyable error of "ls -l | moire" (with xscreensaver installed)
[+] htfy96|8 years ago|reply
It would be nice for someone to develop a suicide-g++. Whenever you compile a program that results in Undefined Behavior, the execution of it will wipe your disk.
[+] majewsky|8 years ago|reply
So it just always writes a program that does `system(rm -rf /)`?
[+] johnvonneumann|8 years ago|reply
My team is considering running this in Production. Do you offer support contracts?
[+] gumby|8 years ago|reply
bash corrects your spelling?? Is this a cute way of saying "I made a typo that turned out to be a legit command" or is there some DWIM I don't know about (and thankfully don't have enabled)?
[+] waterhouse|8 years ago|reply
In the video, the banner the shell displays says:

  =========================================================
  WARNING: Suicide Linx installed
           (http://sourceforge.net/projects/suicide-linux/)
  =========================================================
I'm wondering if the typo is a subtle joke.
[+] stevefan1999|8 years ago|reply
We should call it Russian Linux: just like how you would like to play a Russian Roulette.
[+] mar77i|8 years ago|reply
One idea I like is randomly flipping a bit on the root partition every day or so. You'll have to take an incredibly long time to find the problem, of which there will be one eventually.