ShellGPT logo

ShellGPT

Free

Use ChatGPT from the command-line.

FreeFree tier
Inputs: textOutputs: text
Type
Open Source

About ShellGPT

ShellGPT is a command-line productivity tool powered by AI large language models (LLMs) such as GPT-5. It streamlines the generation of shell commands, code snippets, and documentation directly in the terminal, reducing the need for external resources like Google searches. It supports Linux, macOS, and Windows, and works with all major shells including PowerShell, CMD, Bash, and Zsh. Users can prompt the tool via stdin or command-line arguments, and it can analyze logs, generate git commit messages, and more. The tool is open-source and can be installed via pip, but requires an OpenAI API key (with associated costs) unless configured with a local model like Ollama.

Key Features

Generates shell commands, code snippets, and documentation from natural language prompts
Supports stdin and command-line argument input
Can analyze logs, generate git commit messages, and summarize files
Provides a --shell flag to generate and optionally execute shell commands
Compatible with Linux, macOS, Windows and all major shells (PowerShell, CMD, Bash, Zsh)
Open-source and installable via pip
Supports local LLMs via Ollama (experimental)

Pros & Cons

Pros
  • Free and open-source with no usage limits
  • Works across multiple platforms and shells
  • Can generate and execute commands for faster workflows
  • Easy installation via pip
  • Accepts input from pipes and files for flexible use
Cons
  • Requires an OpenAI API key for default usage, which incurs costs
  • Local model support is experimental and not optimized
  • Relies on an external API (unless using local models)
  • May not work as expected with all local LLM backends

Best For

Quickly generate shell commands without searching syntax onlineSummarize documents or logs directly in the terminalCreate git commit messages based on diffsAnalyze error logs and suggest solutionsGenerate code snippets for common programming tasksAnswer general knowledge questions from the command line

FAQ

How do I install ShellGPT?
Install via pip: pip install shell-gpt. By default, it uses OpenAI's API and GPT-4 model; an API key is required.
Can I use ShellGPT with local models?
Yes, you can set up your own LLM backend such as Ollama. A detailed guide is available, but note that ShellGPT is not optimized for local models.
Does ShellGPT work on Windows?
Yes, ShellGPT supports Windows, Linux, and macOS, and works with PowerShell, CMD, Bash, Zsh, and other major shells.
How do I generate shell commands with ShellGPT?
Use the --shell (or -s) flag followed by your prompt, e.g., sgpt --shell "find all json files".