AskGPT is a lightweight Bash script that turns your terminal into an AI-powered command-line assistant. Type natural language like:
ask "show all listening ports"…and get the exact shell command back—copied straight to your clipboard.
-
🗣 Natural Language Queries Ask for a terminal command in plain English. No syntax memorization required.
-
📋 Clipboard Copy The result is automatically copied to your clipboard via
xclip. -
🧠 Context-Aware Memory Remembers the last 10 questions and responses and includes them in the prompt for improved relevance.
-
🛠 Automatic Setup Installs
xclipif missing. Just drop in and go. -
⚡ Fast & Local Just Bash +
curl+jq. No extra dependencies or daemons.
-
Save the Script Run this one-liner in your terminal:
mkdir -p ~/.local/bin && curl -o ~/.local/bin/askgpt.sh https://raw.githubusercontent.com/motionharvest/AskGPT-Terminal-Command-Assistant/main/askgpt.sh && chmod +x ~/.local/bin/askgpt.sh
-
Create an Alias Add this to your
~/.bashrcor~/.zshrc:alias ask='~/.local/bin/askgpt.sh'
Then reload your shell:
source ~/.bashrc # or source ~/.zshrc
Just type:
ask "find large files in this directory"And you’ll get:
find . -type f -exec du -h {} + | sort -rh | head -n 10The command is printed to the terminal and automatically copied to your clipboard.
AskGPT creates and maintains a memory file at:
~/.local/bin/askgpt.memoryIt stores the last 10 question-response pairs and reuses them as context for better continuity.
This script uses the OpenAI API. You’ll need a valid sk- or gpt-4o project key. Add it inside the script like this:
API_KEY="your_openai_key_here"The more you use it, the smarter your session becomes—without ever storing data online. It's just shell + memory.
MIT License. Use it, modify it, share it. Just don’t paste your API key in a public repo.