Skip to content

Terminal Commander AI is a smart, natural language terminal assistant that converts English instructions into safe, executable shell commands. It supports ROS operations, multi-terminal launching, command explanations, and history — powered by a local TinyLlama LLM.

License

Notifications You must be signed in to change notification settings

srinathvv-dev/TerminalCommander

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

🖥️ Terminal Commander AI

AI-powered natural language terminal assistant with ROS integration

Overview

Terminal Commander is a Python-based tool that translates natural language instructions into terminal commands using a local LLM. It supports launching new terminals, executing shell commands, interpreting ROS-specific instructions (e.g., roscore, roslaunch), and providing contextual help or command explanations.

This tool makes terminal usage more intuitive by allowing users to interact in plain English, with built-in safeguards against dangerous commands.


✨ Features

  • 🧠 Natural language to terminal command conversion using TinyLlama
  • 🤖 ROS-aware commands like roscore, roslaunch, and rostopic list
  • 🪟 Launch commands in new terminal windows
  • 🔐 Detects and blocks dangerous operations
  • 📚 Context-aware help system with categorized examples
  • 💬 Inline command explanations and improvement suggestions
  • 🧾 Maintains command history with replay support

🔧 Requirements

  • Python 3.7+
  • Linux/macOS/Windows
  • llama-cpp-python
  • TinyLlama model (tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf) — placed in the working directory

Install dependencies:

pip install llama-cpp-python

Download TinyLlama from Hugging Face or another source and place the .gguf file in the same directory as the script.


🚀 Running the Script

Make the script executable:

chmod +x terminal_commander.py

Then run:

./terminal_commander.py

🗣️ Example Commands

Try typing:

  • launch terminal with rostopic list
  • start roscore in new terminal
  • list all files
  • find 'TODO' in all files
  • !ls -a (direct execution)
  • explain grep -r foo .
  • suggest chmod 777 file.txt

💡 Special Commands

  • help — Show categories and usage examples
  • help <category> — Show detailed examples (e.g. help Terminal Operations)
  • explain <cmd> — Explain what a command does
  • suggest <cmd> — Suggest a safer or better version
  • history — Show past commands
  • repeat <n> — Run command number n from history
  • !<cmd> — Execute raw terminal command directly

🛑 Built-in Safety

This script detects and blocks unsafe commands, including:

  • Recursive deletion (rm -rf)
  • Disk overwriting (dd, mkfs)
  • Fork bombs
  • Permission abuse (chmod 777, etc.)

⚙️ Supported Terminals

The script auto-detects your terminal emulator. On Linux, it supports:

  • gnome-terminal
  • konsole
  • xfce4-terminal
  • kitty
  • xterm (fallback)

macOS: Terminal.app Windows: cmd.exe


📁 File Structure

.
├── terminal_commander.py
├── tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
└── README.md

🔍 Help Categories

Use help to explore:

  • Terminal Operations
  • Basic File Operations

You can type help Terminal Operations for command examples in that group.


🧠 Model Details

This tool uses TinyLlama 1.1B Chat, a lightweight transformer LLM capable of quick inference on local hardware.

Model parameters used:

  • n_ctx=2048
  • n_threads=8
  • n_gpu_layers=40

Feel free to adjust these for your machine.


📜 License

MIT License © 2025 Srinath V V

About

Terminal Commander AI is a smart, natural language terminal assistant that converts English instructions into safe, executable shell commands. It supports ROS operations, multi-terminal launching, command explanations, and history — powered by a local TinyLlama LLM.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages