A terminal command prefiller that uses Groq AI to generate shell commands from natural language queries.
Eg:
qx search for pattern in all files
# → grep -r pattern .Instead of trying to remember complex command syntax, just describe what you want to do in plain English, and qx will generate the command for you. The command is automatically copied to your clipboard, ready to paste and execute.
- 🤖 AI-Powered: Uses Groq's fast LLM to understand your command intent
- ⚡ Instant: Commands are generated in milliseconds
- 📋 Auto-Copy: Generated commands are automatically copied to your clipboard
- 🔧 Shell Integration: Install a
qq()shell function for seamless integration - 🔐 Secure: Your API key is stored locally in your shell profile
- 🎯 Cross-Platform: Works on macOS, Linux, and Windows
- ✨ Free: Uses Groq's free tier (no credit card required)
brew tap Samuel787/tap
brew install qxgit clone https://github.com/Samuel787/qx
cd qx
make build
make installThis builds the binary and installs it to /usr/local/bin/qx.
- Visit https://console.groq.com
- Sign up for a free account
- Navigate to the API Keys section
- Click Create API Key to generate a new key
- Copy the API key
The Groq API is completely free with the following limits:
- Rate Limit: 30 requests per minute
- Input Tokens: Up to 8,000 tokens per request
- Models: Access to fast LLM models (Llama 3.3 70B, Mixtral, etc.)
- No Credit Card: Use indefinitely at no cost
For more details, see the Groq Documentation
qx set-key YOUR_GROQ_API_TOKENExample:
qx set-key gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxThe command will:
- Add the API key to your shell configuration (
~/.zshrcor~/.bashrc) - Copy the activation command to your clipboard
- Display instructions for reloading your shell
After running this command, follow the on-screen instructions to activate the API key.
Query Groq AI for a command using natural language:
qx <your query here>The generated command is:
- Displayed in your terminal
- Automatically copied to your clipboard
- Ready to paste and execute
# List all files in the current directory
qx list all files in current directory
# Output: ls -la
# ✅ Copied to clipboard!
# Find files named "test"
qx find files named test
# Output: find . -name test
# ✅ Copied to clipboard!
# Count lines in a Python file
qx count lines in a Python file
# Output: wc -l *.py
# ✅ Copied to clipboard!
# Git: Show commit history
qx show git commit history
# Output: git log --oneline
# ✅ Copied to clipboard!
# Git: Create a new branch
qx create a new git branch named feature-x
# Output: git checkout -b feature-x
# ✅ Copied to clipboard!For an even more seamless experience, install the qq() shell function. This allows you to use qq directly from your terminal without even typing qx.
qx qq-installThis will:
- Add a
qq()function to your shell profile (~/.zshrcor~/.bashrc) - Copy the reload command to your clipboard
- Display instructions for activating the function
After installation, reload your shell by one of these methods:
# Option 1: Run the source command (copied to clipboard)
source ~/.zshrc
# or
source ~/.bashrc
# Option 2: Close and reopen your terminal
# Option 3: Start a new shell
exec $SHELLOnce installed, you can use qq directly:
qq <your query>On zsh: The command is prefilled on your command line, ready to execute with Enter
On bash: The command is copied to clipboard and added to history. Press Cmd+V (or Ctrl+V) to paste, or press the Up arrow to recall from history.
# List files
qq list all files
# zsh: Command appears on command line
# bash: Command copied to clipboard
# Show disk usage
qq show disk usage
# Output: df -h
# Kill a process by name
qq kill process named node
# Output: pkill node
# Change git branch
qq change git branch
# Output: git checkout
# Search for files
qq find all javascript files
# Output: find . -name "*.js"
# View recent git changes
qq show recent git changes
# Output: git log --oneline -n 10If you want to remove the qq() function:
qx qq-uninstallThis will:
- Remove the
qq()function from your shell profile - Copy the reload command to your clipboard
- Display instructions for reloading your shell
After running this, reload your shell using one of the methods above.
Generate a command from a natural language query.
Aliases: None (this is the default behavior)
Example:
qx how to list files recursivelyOutput: ls -laR (copied to clipboard)
Generate a command and output it as raw text without formatting or clipboard copy.
Useful for scripting or when you want just the command text without the pretty formatting.
Example:
qx --raw count lines in all python filesOutput: wc -l *.py
Set your Groq API key in your shell configuration.
Usage:
qx set-key YOUR_GROQ_API_TOKENWhat it does:
- Stores the API key as
QX_GROQ_KEYenvironment variable - Updates your shell profile (
~/.zshrcor~/.bashrc) - Copies the reload command to clipboard
- Shows instructions for activation
Example:
qx set-key gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
# API key has been set. Now run the following to activate:
# source ~/.zshrc
# ✅ Command copied to clipboard!Install the qq() shell function for seamless integration.
Usage:
qx qq-installWhat it does:
- Adds the
qq()function to your shell profile - Copies the reload command to clipboard
- Shows instructions for different reload methods
Outputs instructions for:
- Running
source ~/.zshrc(copied to clipboard) - Closing/reopening your terminal
- Running
exec $SHELL
Remove the qq() function from your shell profile.
Usage:
qx qq-uninstallWhat it does:
- Removes the
qq()function from your shell profile - Cleans up extra blank lines
- Copies the reload command to clipboard
- Shows instructions for reloading
Display help information about qx and available commands.
Usage:
qx --help
qx -hCopy text to your clipboard and display it.
Mostly a utility command for testing clipboard functionality.
Usage:
qx hello "Hello, World!"# List files with details
qx list files with details
# → ls -la
# Show current directory
qx print working directory
# → pwd
# View file contents
qx view contents of file.txt
# → cat file.txt
# Create a directory
qx create a new directory named myproject
# → mkdir myproject# Find large files
qx find files larger than 100MB
# → find . -size +100M
# Search text in files
qx search for pattern in all files
# → grep -r pattern .
# Compress files
qx create tar gz archive of current directory
# → tar -czf archive.tar.gz .
# View system info
qx show system information
# → uname -a
# List installed packages
qx list installed packages
# → npm list -g (for Node)
# → pip list (for Python)# View commit log
qx show git commit history
# → git log --oneline
# Create new branch
qx create git branch named feature-auth
# → git checkout -b feature-auth
# Show changes
qx show git changes
# → git diff
# Stage changes
qx stage all changes in git
# → git add .
# Commit changes
qx commit changes with message
# → git commit -m "message"
# Push to remote
qx push changes to git remote
# → git push origin main# Simple command generation
qq how to find files
# → find . -name pattern
# Complex queries
qq recursively find all json files and count them
# → find . -name "*.json" | wc -l
# Git workflows
qq show my unpushed commits
# → git log origin/main..HEAD
# System administration
qq kill all node processes
# → pkill -f nodeSolution: Make sure qx is installed and in your PATH.
# If installed from source
make install
# Verify installation
which qx
qx --helpSolution: The qq() function hasn't been installed yet, or your shell hasn't been reloaded.
# Install the function
qx qq-install
# Reload your shell
source ~/.zshrc # or ~/.bashrcSolution: Your API key hasn't been set. Set it with:
qx set-key YOUR_GROQ_API_TOKEN
# Then reload your shell:
source ~/.zshrc # or ~/.bashrcSolution: Make sure you set the API key and reloaded your shell:
# Check if API key is set
echo $QX_GROQ_KEY
# If not set, do this:
qx set-key YOUR_GROQ_API_TOKEN
source ~/.zshrc
# Then try again:
qq list filesThe AI does its best, but sometimes might misinterpret queries. Try:
- Being more specific:
qx find files named test.jsinstead ofqx find test files - Using common command patterns:
qx grep pattern in filesinstead ofqx search for text - Checking the Groq API status at https://console.groq.com
MIT License - See LICENSE file for details
Found a bug or want to contribute? Feel free to open an issue or pull request on GitHub.
Built by Samuel787 and Mohamedirfansh