Learn about ShellGPT: Converting text into terminal commands.
Working in the terminal is often slow and frustrating. You waste precious minutes, even hours, switching between Google and the terminal just to find the right command or figure out the syntax for a script. This constantly interrupts concentration and makes even small tasks tedious. Then ShellGPT came along and changed everything. Now you can describe what you want in simple English, and it instantly generates the exact shell command or snippet you need. Tasks that used to take 20 or 30 minutes now only take seconds.
What is Shell GPT?
ShellGPT (or sgpt) is an AI-powered command-line interface (CLI) tool that integrates large language models (LLMs) , such as OpenAI's GPT family, directly into your terminal. It acts as a productivity assistant, allowing users to generate shell commands, code snippets, documentation, and answers to general knowledge questions using natural language prompts.
Installing ShellGPT on Linux
ShellGPT requires Python 3 and pipx. You can install them using the following command:
sudo apt install python3-full python3-venv pipx -y Next, run the following command to ensure you can use the installed applications using pipx from the terminal:
pipx ensurepath Finally, install ShellGPT system-wide using pipx:
pipx install shell-gpt
ShellGPT is free, but using OpenAI to get AI feedback requires a small fee. You can also run local AI models with ShellGPT for free, which is useful if you want to avoid any fees. ShellGPT is similar to Gemini CLI, and is a good alternative if you want to avoid Google at all costs.
To use OpenAI, create an API key on the OpenAI platform. Then, set it up in your environment. You can use the following command to set the API key only for the current session:
export OPENAI_API_KEY="chỉ-định-API-key-của-bạn-tại-đây" To make the changes permanent, add the above code to the '~/.bashrc' or '~/.zshrc' file, then apply the changes using the following command:
source ~/.bashrc Next, run the following command to verify that ShellGPT has been properly installed on your system:
sgpt --help
Now you're ready to turn your speech into terminal commands.
Using ShellGPT for AI queries
People often have to switch between the terminal and the browser just to find the right command or solution. Now, you can ask general questions and get answers directly from the terminal.
sgpt "What is Dockpeek?"
ShellGPT saves time, minimizes context switching, and makes working in the terminal much smoother and more intuitive.
Run commands directly using simple English.
Many people used to waste time trying to remember all the terminal commands, often getting distracted and slowing down even simple tasks. With ShellGPT, that stress is gone. Now you just type what you want in simple English:
sgpt "how to find the free disk space on my system" ShellGPT explains the command and shows exactly what to run. This not only saves time but also helps you gain a deeper understanding of the commands.
ShellGPT is not just for explaining commands. If you want to execute commands directly, you can use the -s option .
sgpt -s "find free disk space on my system" Here, -s runs the command immediately, skipping the explanation.
This flexibility allows you to decide when you need guidance and when you just want results.
Create commands without explanation.
Sometimes you just need the command itself, without any additional text. ShellGPT makes this easy. For example, to delete a Docker image, enter your command with the -c option, and ShellGPT transforms the words into ready-to-use commands:
sgpt -c "how can I remove a Docker image" This saves you the effort of searching on forums or in guides.
Chat with ShellGPT
Multi-step tasks often disrupt workflows, cause distractions, and lead to repetitive steps. ShellGPT's chat mode addresses this problem. It allows for maintaining a single conversation and building each step naturally:
sgpt --repl chatName For example, create a session for disk-related tasks and continuously ask follow-up questions. ShellGPT remembers the context, provides step-by-step instructions, and allows you to focus on a single problem:
sgpt --repl disk-info
This feature has really simplified the workflow for complex tasks.
You should read it
- ★ How to run 2 or more Terminal commands at the same time on Linux
- ★ Guide to network operation for Linux users: 11 commands to know
- ★ 14 interesting Linux commands in Terminal
- ★ 6 Linux permission commands every admin needs to know
- ★ 18 Interesting Linux Commands in Terminal
- ★ The most detailed guide on how to change your location on your phone.
- ★ 3 factors that contribute to the successful deployment of AI agents in the real world.
- ★ 10 situations where you shouldn't use ChatGPT
- ★ 8 Best AI Tools for Social Media Management
- ★ Tips that helped Claude Code learn from his mistakes and improve his performance over time.
- ★ Embrace cinematic realism in AI photography with Nano Banana Pro.