Drive a locomotive through your Linux terminal

Using the sl command, you can train yourself to get on track with a fun command-line experience.
215 readers like this.
Linux toy: sl

Jason Baker

It's December, and every Linux terminal user deserves a reward just for making through the year. So we're bringing you a sort of advent calendar of Linux command-line toys. What's a command-line toy? It might be a game, a pointless little time waster, or just something to bring you joy at the terminal.

Today's Linux command-line toy is a suggestion from community moderator Ben Cotton. Ben suggested sl, which is short for steam locomotive.

It's also, conveniently and not coincidentally, a common typo for the Linux ls command. Want to stop mistyping ls? Try installing sl. It's probably packaged for your default repos. For me, in Fedora, that means it was as simple to install as:

$ sudo dnf install sl

Now, just type sl to try it out.

Animation of sl

You may notice, as I did, that Ctrl+C doesn't derail your train, so you have to wait for the entire train to pass. That'll teach you to mistype ls!

Want to check out the source to sl? It's over on GitHub.

sl is also a great opportunity to share a personal PSA about open source licensing. While its license was "open source enough" to be packaged for my distribution, it's not technically an OSI-approved license. After the copyright line, the license reads simply:

Everyone is permitted to do anything on this program including copying,
modifying, and improving, unless you try to pretend that you wrote it.
i.e., the above copyright notice has to appear in all copies.

Unfortunately, when you chose a license that's not OSI-approved, you may accidentally be creating extra work for your users, as they must figure out whether your license will work for their situation. Do their corporate policies allow them to contribute? Can they even legally use the program? Does the license mesh with the license of another program they wish to integrate with it?

Unless you're a lawyer (and perhaps, even if you are), navigating the space of non-standard licenses can be tricky. So if you're still looking for a New Year's Resolution, why not resolve to choose only OSI-approved licenses for any new projects you start in 2019.

No disrespect to the creator, though. sl is still a great little command-line toy.

Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end.

Check out yesterday's toy, Box yourself in on the Linux command line, and check back tomorrow for another!

What to read next
User profile image.
Jason was an staff member and Red Hatter from 2013 to 2022. This profile contains his work-related articles from that time. Other contributions can be found on his personal account.


Heh. Fancy Ben starting with a train. Boiler Up!

It's precisely this kind of innovative productivity-enhancing tools that really get me excited. Great article!

It is a fun little distraction. sl -e would allow CTRL-C

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.