Linux / UNIX Desktop Fun: Steam Locomotive

by on May 26, 2011 · 21 comments· LAST UPDATED December 20, 2011

in , ,

One of the most common mistake is typing sl instead of ls command. I actually set an alias i.e. alias sl=ls; but then you may miss out the steam train with whistle.

sl is a joke software or classic UNIX game. It is a steam locomotive runs across your screen if you type "sl" (Steam Locomotive) instead of "ls" by mistake.

Install sl

Type the following command under Debian / Ubuntu Linux, enter:
# apt-get install sl
It is also available on FreeBSD and other UNIX like operating systems. Next, mistyped ls command as sl:
$ sl

Fig.01: Run steam locomotive across the screen if you type "sl" instead of "ls"

Fig.01: Run steam locomotive across the screen if you type "sl" instead of "ls"


It also supports the following options:

  • -a : An accident seems to happen. You'll feel pity for people who cry for help.
  • -l : shows little one.
  • -F : It flies.
  • -e : Allow interrupt by Ctrl+C.

Related: Linux / UNIX Desktop Fun: Terminal ASCII Aquarium.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 21 comments… read them below or add one }

1 vamsi May 27, 2011 at 3:58 am

Awesome ;)
working with ls will be more fun now .

Reply

2 Elaine May 27, 2011 at 1:13 pm

I installed sl and saw the locomotive, but it didn’t whistle. Bummer.

Reply

3 TryMe May 27, 2011 at 3:27 pm

Not sure about Linux but on the Solaris boxes it actually made a very loud whistle noise. It sent the audio to the hardware speaker inside the case. It means everyone in the Lab knew that you mistyped ls.. lol!

Reply

4 spartan May 29, 2011 at 6:55 am

is fun but no whistle

Reply

5 dgarratt May 29, 2011 at 12:12 pm

no whistle on fedora 15 :-( oh well ill makes typo’s more fun!

Reply

6 jaysunn June 12, 2011 at 4:44 pm

SCHAAAAAAAWEEEEET

Reply

7 RawShark June 19, 2011 at 2:50 pm

Confirm no whistle on Ubuntu 10.04 LTS (64 bit)

Reply

8 hari prasad k July 8, 2011 at 11:33 am

i want to see the code of sl command can i…

Reply

9 sathish damodaran suresh July 14, 2011 at 3:00 am

@ Hari -> i want to see the code of sl command can i

Yes you can here are the steps. Execute the following command

username@Linux-ubuntu:~$ whereis sl
sl: /usr/bin/sl /usr/share/man/man6/sl.6.gz

You should get the sl script location -> sl: /usr/bin/sl

Then you need to navigate to that path

username@Linux-ubuntu:~$ cd /usr/bin/

Now execute the below command to view the script

username@Linux-ubuntu:~$ strings sl
##################################################################
##################################################################
/lib/ld-linux.so.2
libncurses.so.5
__gmon_start__
_Jv_RegisterClasses
scrollok
stdscr
waddch
noecho
_fini
endwin
_init
wrefresh
leaveok
COLS
mvcur
wmove
initscr
LINES
libc.so.6
_IO_stdin_used
signal
usleep
__libc_start_main
_edata
__bss_start
_end
GLIBC_2.0
PTRh
<Fu
t-<at"~
[^_]
[^_]
[^_]
[^_]
[^_]
VUUU
<[^_]
WVSQ
Y[^_]
[^_]
(   )
(    )
(  )
(@@@)
(@@@@)
(@@)
Help!
____________________
|  ___ ___ ___ ___ |
|  |_| |_| |_| |_| |
|__________________|
   (O)        (O)
____
|   \@@@@@@@@@@@
|    \@@@@@@@@@@@@@_
|                  |
   (O)       (O)
     ++      +------
     ||      |+-+ |
   /---------|| | |
  + ========  +-+ |
 _|--O========O~\-+
//// \_/      \_/
 _|--/O========O\-+
 _|--/~O========O-+
 _|--/~\------/~\-+
//// \_O========O
//// \O========O/
//// O========O_/
    _________________
   _|                \_____A
 =|                        |
 -|                        |
__|________________________|_
|__________________________|_
   |_D__D__D_|  |_D__D__D_|
    \_/   \_/    \_/   \_/
      ====        ________                ___________
  _D _|  |_______/        \__I_I_____===__|_________|
   |(_)---  |   H\________/ |   |        =|___ ___|
   /     |  |   H  |  |     |   |         ||_| |_||
  |      |  |   H  |__--------------------| [___] |
  | ________|___H__/__|_____/[][]~\_______|       |
  |/ |   |-----------I_____I [][] []  D   |=======|__
__/ =| o |=-~~\  /~~\  /~~\  /~~\ ____Y___________|__
 |/-=|___|=    ||    ||    ||    |_____/~\___/
  \_/      \O=====O=====O=====O_/      \_/
 |/-=|___|=O=====O=====O=====O   |_____/~\___/
  \_/      \__/  \__/  \__/  \__/      \_/
__/ =| o |=-O=====O=====O=====O \ ____Y___________|__
__/ =| o |=-~O=====O=====O=====O\ ____Y___________|__
 |/-=|___|=   O=====O=====O=====O|_____/~\___/
  \_/      \_O=====O=====O=====O/      \_/
##################################################################

Reply

10 Ikhwan Maftuh June 5, 2012 at 7:17 am

wow it’s cool man… :D

Reply

11 Steve Parker August 5, 2012 at 9:09 pm

@hari prasad k
cd /tmp/sl
apt-get source sl

Reply

12 Jacob September 12, 2012 at 9:50 am

ha ha :-) Perfect example of the fact, that good things can come from beein bored…

Reply

13 Monk September 29, 2012 at 9:12 am

Okai if you wanna a train whistle / air whistle, create a script as follows:

#!/bin/sh
# ~/bin/sl-wrapper.sh
/usr/bin/aplay -N -q ~/train-whistle.wav &
/usr/games/sl

aplay is my command line .wav file player and download .wav files here. Now set alias as follows in ~/.bashrc:

alias sl="$HOME/bin/sl-wrapper.sh"

You can thank me later :) .

Reply

14 Shang-Lin January 28, 2013 at 11:38 pm

You can get the source code from the author’s web page: http://www.tkl.iis.u-tokyo.ac.jp/~toyoda/index_e.html.

Reply

15 TGIF February 9, 2013 at 11:56 am

And whats even more annoying is when you place in your bashrc:
alias ls=’sl’
Place it on a friday afternoon 5pm at a active used server, save, quit and leave for a week or 2 to a sunny location of choice.

Reply

16 David Judik February 22, 2013 at 12:19 pm

If you want whistle on Mac, you can use Sox, and this script:
play -q ~/whistle.wav & sl $*
and after that make an alias to this script.

Reply

17 daniel January 17, 2014 at 1:47 pm

Try doing sl-h its a long one

Reply

18 Rodney February 7, 2014 at 8:43 pm

The -e option to allow ctrl+c does not exist. Source code at https://github.com/mtoyoda/sl/blob/master/sl.c

Reply

19 IT Admin February 13, 2014 at 4:32 am

Confirm no sound and no colour in Ubuntu 13

Reply

20 Selenia July 23, 2014 at 7:32 pm

Works in Debian Jessie but no whistle. Does not work in root terminal in the default install directory as it installs in /usr/games, whose content mostly should not be setup to run as root anyways. So, quick workaround:
root@selenia-laptop:/home/selenia# sl
bash: sl: command not found
root@selenia-laptop:/home/selenia# whereis sl
sl: /usr/games/sl /usr/share/man/man6/sl.6.gz
root@selenia-laptop:/home/selenia# ln -s /usr/games/sl /usr/bin/sl
root@selenia-laptop:/home/selenia# sl

Worked on the subsequent sl command as root :)

Reply

21 Selenia July 23, 2014 at 7:41 pm

Actually, more proper workaround when I thought about it for one minute. So I deleted the symbolic link and did this:
nano /etc/bash.bashrc
Put this at the bottom of your file or above the http proxy lines(if they exist)
alias sl=”/usr/games/sl”
Save the file and type
bash
This reloads the config file.
Now type the command and it should work. Figured this is nicer working in root too for us traditional Debian people who use su for a root terminal with sudo disabled.

Reply

Leave a Comment

Tagged as: , , , , , , , , , ,

Previous post:

Next post: