Ask ChatGPT for a shell script, code, or anything, directly from your terminal 🤖🧠👨💻
Demo

Install
The binary is named gpt when installed, not shell-gpt.
Cargo
From source
Usage
On first usage, ShellGPT will prompt you to enter your OpenAI API key.
This key will then be saved to ~/.config/shell-gpt-rs, encrypted with ChaCha20-Poly1305, to be reused later.
Any question
Ask any question to ChatGPT.
--script
Ask ChatGPT to create a script, then run it if you want to. A pre-prompt will be included with your request.
#!/bin/bash
| |
)
--raw
Ask ChatGPT to create a script, but do not show a loading spinner or interactive prompt, does not run the script.
This can be used to pipe the script to another command.
| |
--clear-config
Remove local config, including the OpenAI API key at ~/.config/shell-gpt-rs.
Help message
Ask ChatGPT for a shell script, code, or anything, directly from your terminal 🤖🧠👨💻
Usage: gpt <your_question>
Options:
-s --shell Ask ChatGPT for a shell script [boolean=false]
--raw Only output the script, no spinner or interactive prompt [boolean=false]
--clear-config Remove local config, including the OpenAI API key at `~/.config/shell-gpt-rs` [boolean]
-h, --help Show help [boolean]
Examples:
gpt is the earth flat?
gpt --shell show the list of files in the current directory with human-readable file size
gpt -s find the top 10 biggest files in the current directory
gpt -s find the top 10 biggest files in the current tree recursive
gpt --raw --shell find the top 10 biggest files in the current tree recursive
gpt --raw --shell find the top 10 biggest files in the current tree recursive > 10_biggest_files.sh
gpt --raw tell me a good joke | curl -X POST -d @- https://example.com/api/jokes
shell-gpt-rs - https://github.com/rigwild/shell-gpt-rs
Examples
# Save the script to a file
# Generate a joke then post it with curl
|
License
The MIT license