Steam Locomotive (sl) is a small terminal program on Unix/Linux systems that displays an animated steam train when executed.
It was created as a joke utility to correct users who mistakenly type:
sl instead of:
ls Instead of listing directory contents, it punishes the typo by running a train across your screen 😄
The program serves several purposes:
sudo apt install sl sudo dnf install sl brew install sl Simply type:
sl 👉 A steam locomotive will animate across your terminal screen.
sl supports several flags that change how the train behaves:
-l (Little Train)sl -l -F (Flying Train)sl -F -a (Accident Mode)sl -a sl -laF Even though it looks simple, sl demonstrates key concepts:
usleep, loops) to control animation speedHere’s a basic idea of how a Bash-based animation might work:
#!/bin/bash
for i in {1..50}
do
clear
printf "%${i}s" "🚂"
sleep 0.05
done 👉 This is a simplified version. The real sl is written in C for performance and smoother animation.
The original program:
ncurses or terminal control librariesAfter installing, you might run:
sl …and get:
command not found 👉 Fix:
export PATH=$PATH:/usr/games (Some systems install it in /usr/games)
Using sl, beginners learn:
apt, dnf, brew)Pair sl with:
cowsay fortune Example:
fortune | cowsay This creates a fun and interactive terminal experience.
The Steam Locomotive Bash program (sl) is more than a joke—it’s a gateway into:
It shows that even in serious engineering environments, fun and learning can coexist.
Latest tech news and coding tips.
How to Build APIs That Are Easy to Use, Scale, and Maintain Learn on the…
Almost everyone starts learning JavaScript with the wrong expectations. Let's fix them. Download the Codeflare…
Phaser JS is a powerful, open-source HTML5 game development framework used for creating 2D games that…
JavaScript / Node.js Authentication Libraries 1. Passport.js One of the most popular authentication middleware libraries…
Every profession comes with its own set of tools. A carpenter has a toolbox, a…
Every application that stores and manages data relies on a set of basic operations known…