Skip to content

IshworTM/terminal-emulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ–₯️ Custom Terminal Emulator

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.


πŸš€ Features

  • βœ… Command parsing using shlex
  • βœ… Support for common shell commands:
    • cd, ls, pwd, echo
    • cat, mkdir, rmdir
    • rm (with flags support)
    • touch (with -c flag 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 (cls vs clear)

🧩 Libraries Used

  • os – for interacting with the OS (filesystem, environment, etc.)
  • subprocess – for executing system-level commands safely
  • shlex – for parsing shell-like syntax

πŸ“‚ Project Structure

terminal/
β”œβ”€β”€ src/
β”‚   └── terminal.py      # main file that runs the terminal
β”œβ”€β”€ README.md            # you're reading it
β”œβ”€β”€ .gitignore
β”œβ”€β”€ LICENSE

πŸ’» Getting Started

  1. Clone the repository:
git clone https://github.com/IshworTM/terminal-emulator.git
cd terminal-emulator/src
  1. Run the terminal:
python3 terminal.py

πŸ“Œ Notes

  • You can only run allowed commands (check ALLOWED_COMMANDS dict).
  • 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.

πŸ› οΈ To Do / Ideas to be implemented in the future

  • 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.

βš–οΈ License

MIT License. Do whatever you want, just don’t claim you made it from scratch if you didn’t. Be chill.

About

A simple script that emulates the unix terminal / CLI / shell, using basic Python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages