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