A simple, lightweight, Python-based terminal emulator that mimics common shell commands like cd, ls, touch, rm, mkdir, echo, and more — all built using only basic Python and standard libraries.
- ✅ Command parsing using
shlex - ✅ Support for common shell commands:
cd,ls,pwd,echocat,mkdir,rmdirrm(with flags support)touch(with-cflag support)clear,exit,ping
- ✅ Handles command-line flags like
-c,-rf, etc. - ✅ Graceful error handling for invalid commands
- ✅ Dynamic prompt showing username and current directory
- ✅ Cross-platform support (
clsvsclear)
os– for interacting with the OS (filesystem, environment, etc.)subprocess– for executing system-level commands safelyshlex– for parsing shell-like syntax
terminal/
├── src/
│ └── terminal.py # main file that runs the terminal
├── README.md # you're reading it
├── .gitignore
├── LICENSE
- Clone the repository:
git clone https://github.com/IshworTM/terminal-emulator.git
cd terminal-emulator/src- Run the terminal:
python3 terminal.py- You can only run allowed commands (check
ALLOWED_COMMANDSdict). TERM environment variable not set.error might show when running in an IDE; try running it from a real terminal instead (bash,zsh, etc.).- Designed to be simple and extensible — feel free to add more custom commands.
- Add support for command piping (
|) - Implement file redirection (
>,<) - Add a help command (
man-like info for built-in commands) - History & command autocomplete
- Implement history navigation using the Up/Down arrow keys.
MIT License. Do whatever you want, just don’t claim you made it from scratch if you didn’t. Be chill.