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.