Shex
Execute system commands using natural language. No need to remember complex command syntax.
Install / Use
/learn @YUHAI0/ShexREADME
Shex
Natural language command-line assistant powered by LLM
Execute system commands using natural language. No need to remember complex command syntax.
Features
- 🗣️ Natural Language - Describe what you want in plain language
- 🤖 Multi-LLM Support - DeepSeek, OpenAI, Claude, Gemini, Mistral, Groq, Qwen, and more
- 🔄 Auto Retry - Automatically tries alternative approaches on failure
- ⚠️ Safety First - Confirms before executing dangerous commands
- 🌍 Multi-language - English and Chinese interface
- 💻 Cross-platform - Windows, macOS, and Linux
Installation
Windows (PowerShell):
iwr -useb https://raw.githubusercontent.com/YUHAI0/shex/master/scripts/install.ps1 | iex
Linux/macOS:
curl -fsSL https://raw.githubusercontent.com/YUHAI0/shex/master/scripts/install.sh | bash
Quick Start
# First run will guide you through configuration
shex list all files in current directory
# More examples
shex show disk usage
shex find all python files
shex what is my IP address
shex compress the logs folder
Configuration
First Run
On first run, Shex will guide you to:
- Select your language (English/Chinese)
- Choose an LLM provider
- Enter your API key
Reconfigure
# Change LLM provider
shex --config
# Change language
shex --lang
Supported LLM Providers
| Provider | Model | |----------|-------| | OpenAI | GPT-4o | | Anthropic | Claude 3.5 | | Google | Gemini Pro | | Mistral | Mistral Large | | Groq | Llama 3 | | Cohere | Command R+ | | DeepSeek | DeepSeek Chat | | Qwen | Qwen Plus | | Moonshot | Kimi | | Zhipu AI | GLM-4 |
You can also configure any OpenAI-compatible API.
Usage
# Basic usage
shex <your request in natural language>
# Options
shex --version # Show version
shex --config # Reconfigure LLM
shex --lang # Change language
shex --max-retries N # Set max retry attempts (default: 3)
How It Works
- You describe what you want to do in natural language
- Shex sends your request to the configured LLM
- The LLM generates the appropriate system command
- Shex executes the command and shows the output
- If the command fails, Shex automatically tries alternative approaches
Safety
- Dangerous commands (delete, format, etc.) require user confirmation
- The LLM analyzes each command for potential risks
- You always have the final say before execution
Configuration Files
Configuration is stored in:
- Windows:
%LOCALAPPDATA%\shex\ - macOS/Linux:
~/.config/shex/
Files:
.env- API keys and LLM settingsconfig.json- Language and other preferenceslogs/- Execution logs
License
MIT
Contributing
Issues and pull requests are welcome!
<p align="center"> If this project has been helpful to you, please give it a ⭐️ to show your support! </p>
