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