gencmd

gencmd is an interactive command line utility to generate bash commands from a
natural language description, directly from the console.

Ever went to ChatGPT after struggling some time with man awk, or with
questions like "was it curl or wget with -O"? Well, save some time and ask
directly from the terminal.
Installation
Head over to the
latest release, and download a
binary appropriate for your system.
Make it executable and put it somewhere in $PATH:
chmod a+x gencmd
sudo mv gencmd /usr/local/bin
If you want to set up key bindings (default is Ctrl + G),
add this to your .bashrc:
source ~/.config/gencmd/key-bindings.bash
or use key-bindings.zsh for .zshrc.
API Keys
Initialize with:
gencmd init
The instructions will guide you through setting up an AI model provider. The
currently supported providers are OpenAI, Gemini and Anthropic.
The easiest to get started is to get a free API key from Google AI
Studio. Follow the instructions there and
once you have the key, paste it into the interactive prompt.
Credentials are stored locally, and NEVER sent anywhere else.
[!NOTE]
By default, gencmd uses "gemini-2.0-flash-lite", which has a generous free
tier of 200 requests per day. More than enough for typical usage. If you want
to make sure to block requests over the free tier, use a dedicated GCP project
without billing enabled.
[!TIP]
If you just want to test how gencmd looks without configuring it, you can
try the demo (returning fake history and commands) with gencmd demo.
Usage
Open a new terminal and press Ctrl + G. gencmd should pop
up and ask you for a prompt. This is forwarded to the LLM which will generate a
few alternative commands that should solve your intended usage.
You can navigate history and completions with keyboard arrows ↑
↓, or Ctrl + J and Ctrl +
K.
Examples for inspiration:
- Find all subdirectories
- Count the lines of a file that don't start with #
Building from source
This project is written in Go:
git clone https://github.com/mbrt/gencmd
cd gencmd
go build .