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.
Why borrowing code is a skill—when you understand what you're copying. For years, "copy-paste developer"…
Interactive forms rarely keep every field active all the time. Sometimes an input should only…
A modern JavaScript API for working with dates, times, time zones, and calendars without the…
Understanding What Happens Behind the Scenes Node.js looks simple from the outside—you write JavaScript, call…
The need for absolute certainty is the greatest disease the engineering mind faces. The moment…
The software industry is one of the most competitive places to build a career. Every…