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.
A shell prompt is the text displayed by a command-line shell to show that it is ready…
A SOC Analyst (Security Operations Center Analyst) is one of the frontline defenders of an organization’s cybersecurity…
Most image upload systems assume one thing: the user has a stable internet connection. That assumption…
Imagine a user submits a form while their internet connection suddenly disappears. Normally, the request…
Cybercriminals don't always announce their presence. Many compromises are designed to remain unnoticed for weeks…
For years, jQuery was everywhere. If you were building websites in the 2010s, there was a…