Fun: SL (Steam Locomotive) Runs a Train in Your Linux Terminal

Linux has long been a home for some quirky and some outright funny commands and command-line programs. From a command which brings you your fortune on the terminal, to an ASCII based Star Wars movie, all these commands are a part of developer humor in the Linux World.

One such command is the program ‘sl’‘SL’ stands for Steam Locomotive. This humorous program was created by Toyoda Masashi to interrupt a user whenever he/she erroneously types ‘sl’ instead of ‘ls’ which is a very frequently used command to list files and folders.

It basically displays a terminal-based animation of a passing train across your terminal, which the user cannot even exit with a Ctrl + C signal. So the user has to wait for a few seconds before the train passes.

Let’s see how to install and use the ‘sl’ command in Linux.

Installing SL (Steam Locomotive) in Linux

The SL (Steam Locomotive) command is available in the official repository of Linux systems; hence installation is as simple as:

$ sudo apt install sl   [On Debian/Ubuntu & Mint]
$ sudo yum install sl   [On CentOS/RHEL 7]
$ sudo dnf install sl   [On CentOS/RHEL 8 & Fedora]
$ sudo pacman -S sl     [On Arch Linux]
$ sudo pkg_add -v sl    [On FreeBSD]

Run the command to verify the installation. If installed and working correctly, you should see the train animation shown below.

$ sl

Basic Usage of SL (Steam Locomotive) in Linux

The most basic use of sl is the one we saw above; without any parameters. However, the developers did not stop there. They have added some parameters with which the animation can be modified a bit.

If you call the command with a parameter '-a', it will show the train animation, with people on the train shouting for help.

$ sl -a

Parameter '-l' shows a smaller train in the animation.

$ sl -l

Similarly, with '-F' parameter, the train will appear as if it is flying, instead of going in a straight line.

$ sl -F

These are the three variants of the train animation.

There is another parameter '-e' which will allow the user to close the animation with a Ctrl + C signal when used.

$ sl -e
Conclusion

In this article, we learned about the ‘sl’ command in Linux. Although the command was created for fun, it can be useful to develop a habit of not typing ‘sl’ whenever ‘ls’ is to be typed.

If you have any questions or feedback, let us know in the comments below!

Source: https://github.com/mtoyoda/sl

Got something to say? Join the discussion.