Skip to content

Instantly share code, notes, and snippets.

@martinschenk
Created August 29, 2025 14:02
Show Gist options
  • Select an option

  • Save martinschenk/a5b238a497252183e31d035c77fd1390 to your computer and use it in GitHub Desktop.

Select an option

Save martinschenk/a5b238a497252183e31d035c77fd1390 to your computer and use it in GitHub Desktop.
q - Instant AI Questions in Terminal - Ask AI anything without quotes!

q - Instant AI Questions in Terminal

Ask AI anything from your terminal - no quotes needed!

A tiny wrapper for shell-gpt that makes chatting with AI as simple as typing q + your question.

Why?

Before (slow & annoying)

sgpt "what is docker?"          # ugh, quotes...
sgpt "how does kubernetes work?" # more quotes...
ai "explain git rebase"          # QUOTES EVERYWHERE!

After (fast & natural)

q what is docker?
q how does kubernetes work?
q explain git rebase

That's 4 fewer keystrokes per question! When you ask AI dozens of questions daily, this adds up to minutes saved.

The Speed Advantage

  • No quotes = 2 fewer keystrokes
  • No shift key = faster typing
  • Single letter command = instant access
  • Natural typing = no mental overhead

Type your questions as naturally as you'd type them in ChatGPT, but right in your terminal!

Installation

1. Install shell-gpt

pip install shell-gpt

2. Add to your .zshrc or .bashrc

# q - Quick AI questions without quotes!
# Works with special characters like ? * [] 
alias q='noglob q_function'
q_function() {
    sgpt "$*"
}

# Set your OpenAI API key (add to .env or export separately)
# export OPENAI_API_KEY="your-key-here"

3. Reload your shell

source ~/.zshrc  # or ~/.bashrc

Usage

Ask anything naturally:

q what is the meaning of life?
q how do I center a div in CSS?
q explain quantum computing in simple terms
q what's the difference between TCP and UDP?
q why is my docker container not starting?

Power User Tips

Create specialized shortcuts:

# qc = quick code
alias qc='noglob qc_function'
qc_function() {
    sgpt --code "$*"
}

# qs = quick shell command
alias qs='noglob qs_function'
qs_function() {
    sgpt --shell "$*"
}

# Usage
qc write a python function to sort a list
qs how to find large files in linux

Features

  • Instant AI access - just type q
  • No quotes needed - type naturally
  • Works with special characters - ?, *, [], etc.
  • Ultra-minimal - one letter to AI
  • Compatible with Zsh and Bash
  • Preserves all sgpt features - just wrapped

Security Note

⚠️ Never commit your OPENAI_API_KEY!
Use environment variables or .env files instead.

Keywords

terminal ai command line gpt shell gpt wrapper quick ai questions terminal chatgpt cli ai assistant no quotes shell instant ai terminal

License

MIT


Because every keystroke counts when you're in the flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment