slTrain is a fun and nostalgic Python script inspired by the classic sl steam locomotive command. This script animates a charming steam locomotive chugging across your terminal, complete with a dynamic smoke trail and colorful ASCII art. It's perfect for adding a bit of old-school charm to your terminal sessions. https://stevenmilanese.com
Find a file
developtheweb d0b698eb40 Release 3.0.0: double-buffered renderer, animated wheels, coal cars, whistle
Rewrite the animation engine around a flicker-free double-buffered
renderer on the alternate screen. Add turning wheels, particle smoke,
coal cars (-n), train type selection (-t), whistle (-w), rebuilt fly
and accident modes, --no-color/NO_COLOR support, and a static train
when stdout is not a terminal. All v2 flags remain compatible.
2026-07-06 13:03:51 -04:00
.gitignore Refactor sl from simple script to professional CLI tool 2025-06-05 21:42:48 -04:00
CHANGELOG.md Release 3.0.0: double-buffered renderer, animated wheels, coal cars, whistle 2026-07-06 13:03:51 -04:00
CONTRIBUTING.md Refactor sl from simple script to professional CLI tool 2025-06-05 21:42:48 -04:00
LICENSE Refactor sl from simple script to professional CLI tool 2025-06-05 21:42:48 -04:00
Makefile Refactor sl from simple script to professional CLI tool 2025-06-05 21:42:48 -04:00
README.md Release 3.0.0: double-buffered renderer, animated wheels, coal cars, whistle 2026-07-06 13:03:51 -04:00
requirements.txt Refactor sl from simple script to professional CLI tool 2025-06-05 21:42:48 -04:00
sl Release 3.0.0: double-buffered renderer, animated wheels, coal cars, whistle 2026-07-06 13:03:51 -04:00

🚂 sl - Steam Locomotive

GitHub stars GitHub forks License: MIT Python Platform Maintained Website

A joke command that displays an animated steam locomotive in your terminal when you accidentally type 'sl' instead of 'ls'.

      ====        ________                ___________
  _D _|  |_______/        \__I_I_____===__|_________|
   |(_)---  |   H\________/ |   |        =|___ ___|  
   /     |  |   H  |  |     |   |         ||_| |_||  
  |      |  |   H  |__--------------------| [___] |  
  | ________|___H__/__|_____/[][]~\_______|       |  
  |/ |   |-----------I_____I [][] []  D   |=======|__
__/ =| o |=-~~\  /~~\  /~~\  /~~\ ____Y___________|__
 |/-=|___|=    ||    ||    ||    |_____/~\___/       
  \_/      \O=====O=====O=====O_/      \_/           

🎥 Demo

sl command demo

Watch the train cross your terminal when you mistype!

Features

  • 🚂 Multiple train types - Classic, Small, D51, and C51 locomotives (-t)
  • 🛞 Animated wheels - Wheels that actually turn as the train rolls
  • 💨 Particle smoke - Smoke that drifts behind the train and dissipates
  • 🚃 Coal cars - Couple up to 8 tenders behind the locomotive (-n)
  • ✈️ Flying mode - Make the train fly across the sky with a stardust trail (-F)
  • 💥 Accident mode - Screen shake, sparks, and a proper BOOM (-a)
  • 📣 Whistle - The train toots as it passes (-w)
  • 🖥️ Flicker-free rendering - Double-buffered frames on the alternate screen; your terminal contents are restored when the train has passed
  • 🎨 Colorful ASCII art - Colored trains with grayscale smoke on 256-color terminals; honors NO_COLOR and --no-color
  • Adjustable speed - Control animation speed
  • 📐 Terminal-aware - Handles terminal resizing gracefully; sl | cat prints a static train instead of escape codes
  • 🛡️ Clean exit - Proper cleanup and Ctrl+C handling
  • 🪶 Lightweight - No external dependencies, pure Python

📦 Installation

# Clone the repository
git clone https://github.com/developtheweb/slTrain.git
cd slTrain

# Install to /usr/local/bin
sudo make install

Platform-Specific Instructions

🐧 Linux
# Debian/Ubuntu
git clone https://github.com/developtheweb/slTrain.git
cd slTrain
sudo make install

# Arch Linux (AUR)
# Coming soon!

# Manual install
sudo cp sl /usr/local/bin/
sudo chmod +x /usr/local/bin/sl
🍎 macOS
# Using Homebrew (coming soon)
# brew install sl

# Manual install
git clone https://github.com/developtheweb/slTrain.git
cd slTrain
sudo make install
🐳 Docker
# Run without installing
docker run --rm -it ghcr.io/developtheweb/sl:latest

# Alias for easy use
alias sl='docker run --rm -it ghcr.io/developtheweb/sl:latest'

Uninstall

sudo make uninstall
# or
sudo rm /usr/local/bin/sl

🚀 Usage

Simply type sl instead of ls:

$ sl              # Classic train
$ sl -F           # Flying train
$ sl -a           # Train accident
$ sl -c           # C51 train type
$ sl -l           # Long train (D51 pulling coal cars)
$ sl -n 4         # Pull 4 coal cars
$ sl -t small     # Small train for narrow terminals
$ sl -w           # Sound the whistle
$ sl -s 2.0       # Double speed
$ sl --help       # Show help

Options

Option Long Form Description
-a --accident An accident occurs partway through
-F --fly Make the train fly through the sky
-l --long Use a longer train (D51 pulling coal cars)
-c --C51 Use the C51 train type
-t --type Locomotive type: classic, small, d51, c51 (overrides -l/-c)
-n --cars Number of coal cars to pull, up to 8 (default: 0)
-w --whistle Sound the whistle as the train passes
-s --speed Animation speed multiplier, 0.120 (default: 1.0)
--no-color Disable colors (NO_COLOR is also honored)
-v --version Show version information
-h --help Show help message

🤔 Why sl?

We've all done it - typed sl when we meant ls. Instead of getting an error, why not get a gentle reminder in the form of a steam locomotive chugging across your terminal?

Benefits:

  • 📚 Learn to type more carefully - Muscle memory training through humor
  • 😄 Add whimsy to your command line - Because terminals can be fun too
  • 🎭 Surprise your coworkers - Watch their confusion turn to delight
  • 🧘 Take a brief mental break - Sometimes you need a train break

📋 Requirements

  • Python 3.6 or higher
  • Unix-like terminal with ANSI escape code support
  • A sense of humor 😄

🤝 Contributing

We love contributions! Please see our Contributing Guidelines for details.

Quick Start for Contributors

# Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/slTrain.git
cd slTrain

# Create a feature branch
git checkout -b feature/amazing-feature

# Make your changes and test
./sl -F  # Test your changes

# Commit and push
git commit -m "Add amazing feature"
git push origin feature/amazing-feature

💖 Support the Project

If you enjoy sl, consider supporting the development:

  • Star this repository - It helps others discover the project
  • 🐛 Report bugs - Help us improve by reporting issues
  • 💡 Suggest features - Share your ideas for new train types or animations
  • 🌐 Visit my website - Learn more at StevenMilanese.com
  • Buy me a coffee - Support development at StevenMilanese.com/support

🔒 Security

Found a security issue? Please see our Security Policy for responsible disclosure.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

👨‍💻 Author

Reverend Steven Milanese

🙏 Acknowledgments

  • Inspired by the original sl command by Toyoda Masashi
  • ASCII art trains adapted from various sources
  • Thanks to all contributors who have helped improve this project
  • Special thanks to the first stargazer who inspired this update!

📊 Project Stats

GitHub commit activity GitHub last commit GitHub code size


Remember: It's not a bug, it's a feature! 🚂

Made with ❤️ by Reverend Steven Milanese
Visit StevenMilanese.com for more projects