Settings

Theme

Sl: a steam locomotive in your terminal

aasen.in

99 points by aaasen · 57 comments

Reader

24 threads
nuclear_eclipse

On the Sun/Solaris machines where I first worked, the `sl` command had an added bonus: it played a really loud "choo-choo" sound from the workstation's internal speaker, regardless of volume or mute settings, so you always knew when someone fat-fingered their file listings, and much laughing was had by all.

I very quickly learned to alias sl=ls in my shell rc, and it's still in there to this day, just in case...

Argorak

I highly recommend the debian bug tracker on `sl`:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=614158

Also, for those that love their cars "pre-tuned by german engineers", there is `gti`:

http://r-wos.org/hacks/gti

ggreer

Veteran: "You should apt-get install sl."

Newbie: "What does sl do?"

Veteran: (perfectly straight face) "It trains you."

gee_totes

I've always wondered: why is it a locomotive? Why not a penguin or something else?

Just thinking aloud here: ls stands for 'list'.... so sl stands for 'tsil'.... which is a model of a train? No, that's not it.

I think there's a missing part to this joke.

[edit] Just stepped away from my desk and took two steps and figured it out: sl = steam locomotive

  • pifflesnort

    Regarding the penguin: sl(1) was originally written in 1992; Linux itself didn't hit 1.0 until 1994, and the Linux penguin itself wasn't introduced until 1996.

  • jurre

    sl, steam locomotive.

Oompa

I added this to Homebrew years ago, for those OS X users.

  • Ogre

    I just installed it, thanks!

    Also, brew seems to have added a beer mug emoji to the terminal output when it finishes installing something since the last time I installed anything. I didn't know the terminal (Actually iTerm 2 in this case) even supported that. Neat!

  • ihuman

    It is also in MacPorts

Blahah

When a colleague accidentally types their password to our cluster into a chat window, the first thing I do is login as them and alias ls=sl. Another fun one is to add `telnet towel.blinkenlights.nl` to their .bashrc, so on login they get to watch ascii star wars.

adimitrov

The one bad thing about switching to the Dvorak layout is that in Dvorak, ls is really cumbersome to type. The l isn't on the home-row, and both of them are on the right pinky. The way I do it now, it's virtually impossible to type sl instead of ls.

Typing dc instead of cd, though is still very common. And dc just mockingly tells me: "will not attempt to process directory."

(I now have `no` aliased to ls. Maybe I should alias `on` to sl.)

laumars

    > The following code changes the default behaviour of ls from listing
    > files to turning your terminal into an unstoppable steam locomotive.
    > The only way to end it is closing the terminal, so use this with caution.
erm, that's easily stopped:

    [ctrl]+z
    $ pkill -9 sl
  • eridius

    ^Z will just suspend `sl`, at which point bash will immediately launch another copy. That's what the loop is for.

    • jlgreco

      Have you actually tried it? In neither zsh nor bash does this seem to actually be the case.

      • eridius

        Well no, because I didn't want to install `sl`.

        But it looks like you're right. I just tried `while true; do ( echo hi; sleep 1; echo bye; ); done` and ^Z does stop the cycle.

        • jlgreco

          Interestingly, at least how I have zsh configured and don't have bash configured, the behavior of `fg` after suspending these is different.

          With zsh when I resume the execution it continues looping. However with bash it resumes for only one more iteration.

          • eridius

            Yeah I would have expected `fg` to continue the loop, but it doesn't. If I put `echo $?` after the subshell in that loop, it doesn't even print when I run `fg`. It's like bash just throws away the loop entirely when I suspend the subshell.

    • laumars

      Bash wont immediately launch another copy because the PID is still alive (even if it is stopped).

  • tylermenezes

    erm, no? "while true; sl; done"

    • X-Istence

      Hold ctrl + c down, eventually sl will have quit, and bash will quit the while loop. I've never had issues quitting out of

        while true; do echo "stuff"; done
      
      for example.
    • jlgreco

         zsh: suspended  while true; do sl; done
      
      ?
    • laumars

      erm, yes. I suggest you try it before commenting next time.

rdtsc

Bonus info:

if you add arguments to sl like -l or -a you get a different locomotive or other effects!

Mindless2112

Why alias commands to sl? The point is for it to be triggered on bad typing.

Also, the man page is worth a look -- http://manpages.ubuntu.com/manpages/precise/man6/sl.6.html

captn3m0

The moving train uses js for motion. I stripped that part to http://jsbin.com/ujizup/1

orvtech

I did a little video on this a couple of weeks a go with a mini how to for Fedora users https://news.ycombinator.com/item?id=4766611

frankblizzard

first saw this thing around 12 years ago on an AS/400 terminal. Our neckbearded Lead Programmer was supposed to have programmed it in RPG but probably this thing is even older?

  • Argorak

    The source downloaded from the authors page[1] lists the following modification times:

        [ skade sl ] ls -la *
        -rw-r--r-- 1 skade staff  331 Jul 22  1998 Makefile
        -rw-r--r-- 1 skade staff  417 Jul 22  1998 README
        -rw-r--r-- 1 skade staff  689 Jan 18  1994 sl.1
        -rw-r--r-- 1 skade staff 7.0K Jul 22  1998 sl.c
        -rw-r--r-- 1 skade staff 4.1K Jan 18  1994 sl.h
        -rw-r--r-- 1 skade staff  980 Jan 18  1994 sl.txt
    
    So, it is almost 20 years old.

    [1] http://www.tkl.iis.u-tokyo.ac.jp/~toyoda/index_e.html

benhalllondon

Great, excellent, fun.

But, clearly, it should run 'ls' after doing its choo choo?

  • cliffbean

    That is optimizing for the short term. "When I've run sl, I clearly wanted ls, so you should give me that (even if you also punish me)."

    Optimizing for the long term is also plausible. "Don't reward me for making mistakes (even if you also punish me) because it'll dilute my muscle-memory training, and I'll be more likely to make mistakes in the future."

    Neither of these is inherently more correct than the other. The long term has more uncertainty, but greater potential rewards. We just have to make a judgment call.

    I tend to favor the long-term approach for sl. I can't easily quantify how valuable my stricter muscle-memory training will be, but I can imagine the possibility of a significant upside if I actually become a more precise typer. Also, the worst-case downside just isn't that bad -- retyping ls just isn't that hard.

  • rmk2

    Well, this forces you to type 'ls' again, giving you another chance to see the awesome locomotive! ;)

  • philwelch

    The Unix philosophy is that a program should only do one thing. sl only does one thing.

  • minos

    One could use a shell alias, a function or something similar for that.

niggler

"Note: I actually didn't use a marquee for this. The one good use for one, and I missed it. Damn."

Is this even a good example for using html marquee?

prezjordan

How did you get this in the main repositories? I'm curious what the process is for something like that.

  • blablabla123

    According to someone else's comment this thing is at least 20 years old. AFAIK these things go by popularity, after all any sort of game is also non-productive...

davidroberts

I just installed it on my Raspberry Pi. It's in the Raspian repository too!

nilsbunger

If you're on a Mac with homebrew, "brew install sl" will get you there!

mbubb

Not the same thing but "apt-get moo" on a Debian based box is fun...

dogface

Oh come on! This isn't news. I was using sl fifteen years ago.

mostly_harmless

alternatively if you are really evil, you can 'alias ls="rm -rf"'

jzoidberg

We need one for "got"

  • kmf
    • Watabou

      Okay that is freaking awesome. I now have GoT's theme playing in the terminal.

      This may actually make me misspell git even more.

  • fnordfnordfnord

    Got,

    Got Milk?, Displays Got Milk? Advert. Boring

    GOThic, Changes terminal font to Gothic?

    GoT, Game of Thrones, Decapitates user?, Automatically fires up BitTorrent client and grabs latest episode? Plays ASCII art GoT episode? Cat's all of GRRM's GoT novels into your terminal? (That'll teach you).

systematical

had to apt-get sl

barkingcat

on os x - brew install sl brings it in.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection