AI-powered natural language terminal assistant with ROS integration
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.
- 🧠 Natural language to terminal command conversion using TinyLlama
- 🤖 ROS-aware commands like
roscore,roslaunch, androstopic 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
- 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-pythonDownload TinyLlama from Hugging Face or another source and place the .gguf file in the same directory as the script.
Make the script executable:
chmod +x terminal_commander.pyThen run:
./terminal_commander.pyTry typing:
launch terminal with rostopic liststart roscore in new terminallist all filesfind 'TODO' in all files!ls -a(direct execution)explain grep -r foo .suggest chmod 777 file.txt
help— Show categories and usage exampleshelp <category>— Show detailed examples (e.g.help Terminal Operations)explain <cmd>— Explain what a command doessuggest <cmd>— Suggest a safer or better versionhistory— Show past commandsrepeat <n>— Run command numbernfrom history!<cmd>— Execute raw terminal command directly
This script detects and blocks unsafe commands, including:
- Recursive deletion (
rm -rf) - Disk overwriting (
dd,mkfs) - Fork bombs
- Permission abuse (
chmod 777, etc.)
The script auto-detects your terminal emulator. On Linux, it supports:
gnome-terminalkonsolexfce4-terminalkittyxterm(fallback)
macOS: Terminal.app
Windows: cmd.exe
.
├── terminal_commander.py
├── tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
└── README.md
Use help to explore:
- Terminal Operations
- Basic File Operations
You can type help Terminal Operations for command examples in that group.
This tool uses TinyLlama 1.1B Chat, a lightweight transformer LLM capable of quick inference on local hardware.
Model parameters used:
n_ctx=2048n_threads=8n_gpu_layers=40
Feel free to adjust these for your machine.
MIT License © 2025 Srinath V V