Linux is being used by programmers, developers, and system admins for a very long time. We use the terminal for almost everything, installing/uninstalling, changing directories, cut, copy and pasting, etc.
But Linux also has a lot of unknown commands that you may accidentally type as a misspelling to a commonly used command.
This article is about the sl command which you might type in place of the ls command. We will see how to run a locomotive train in the Linux terminal using a single command.
sl stands for Steam Locomotive. It is created by Toyoda Masashi. It was created to remind you when you mistype the ls command. ls command is used commonly to list the files and folders of the current directory. It shows an animated train passing through the terminal and you can’t exit the program by pressing Ctrl+C.
Installing sl command
The sl command is already in the official repositories so it is very easy to install even for beginners.
- Ubuntu/Debian –
sudo apt install sl - CentOS/Fedora –
sudo dnf install sl - Arch Linux-
sudo pacman -S sl
In this article, we are installing the sl command on Ubuntu.
Open a terminal by pressing Ctrl+Alt+T. Execute the following command to install sl command,
sudo apt install sl

Now, type sl and press enter.

After entering the command, A moving train will appear moving from left to right once, and it cannot be terminated by pressing Ctrl+C so you have to wait till it ends.
There are also some parameters that will show some extra animations. By using -a parameter, You will see a train moving with people shouting for help.
sl -a

By using -l parameter, You will see a smaller train as compared to without parameter.
sl -l

By using -F parameter, You will see a flying train animation.
sl -F

You can also use -e parameter to close the animation in between by using Ctrl+C command.
Frequently asked questions
What is the sl command in Linux?
sl is a small joke program that runs an ASCII steam locomotive across the terminal. Developer Toyoda Masashi built it to catch people who type sl instead of ls.
Why does typing sl show a train instead of an error?
sl only appears because someone installed the sl package. On a system without it, mistyping ls as sl gives the usual command not found error.
How do I stop the sl command once it starts?
The default sl animation ignores Ctrl+C, so you have to let it finish. Running sl -e adds an exception that lets Ctrl+C interrupt the train early.
Can I install sl on macOS?
Yes. macOS users with Homebrew installed can run brew install sl. BSD systems use pkg install sl on FreeBSD or pkg_add on OpenBSD instead.
Does the sl command play a train whistle sound?
It was written to sound a whistle, but that feature does not work on modern Linux distributions or macOS. Most users only get the visual animation.
How do I uninstall the sl command?
Remove it the same way you installed it: sudo apt remove sl on Debian and Ubuntu, sudo dnf remove sl on Fedora or sudo pacman -R sl on Arch.
Are there flags beyond -a, -l and -F?
Yes, newer sl builds on Arch add -d for a disco color mode, -G for a redesigned train, -w for extra speed and a number flag to set car count.
Conclusion
sl (Steam Locomotive) command was created for fun. It is a simple command with easy installation so even beginners can try it. sl will never make anyone more productive. That was never the point. It turns a common typo into a bit of terminal nostalgia and explains why the package still ships in most Linux distro repositories decades later.
