Now, AI is everywhere. It’s the new normal. You can’t leave without AI. If you ignore AI technologies and keep yourselves away from AI technologies, you will be left behind, nobody will care for you, and you will be thrown out to nowhere from this highly competitive world. If you want to be here, learn to adopt AI technologies in your daily life.
It’s a known fact, that we begin with the command line and move to GUI as technology progress, remember first-generation computers? The other fact is. no matter how much we develop the GUI, we still use command-line or terminal even today. Even today, most of the high-level tasks are being carried out on CLI.. Most of the servers run on the terminal or command line even today. This proves how powerful the CLI is.
Undeniably, the CLI is more powerful then GUI. Wait, there are some challenges too. Command line terminals are not user-friendly, you can’t use a terminal without technical knowledge. However, since the development of AI and LLMs, many advancements happened. Technology has stepped into a new generation. The same applied to Terminal users as well.
Now, the technology has grown to the level that anybody can integrate AI and LLMs with their command line and be more productive then ever before. We created this post to help all terminal users especially the security professionals, irrespective of platforms, to get their job done even more efficiently. We will show you how to bring AI to the terminal using a small but powerful AI tool called Shell GPT.
Table of Contents
The Common Challenges of Using CLI
Upon spending more than one and half decades in IT, I even struggled to use the command line interface. Especially, when I have to work on different OS terminals simultaneously. And, when I want to use any specific command line tools, I can’t work without its documentation or help page. Being a security professional I have listed some common challenges of using CLI here and I will also show you how those challenges can be
mitigated by integrating the terminal with an AI LLM tool called Shell GPT later in the blog post.
- Remembering Commands and Flags: With the wide variety of CLI tools, remembering the specific commands, options, flags, and syntax for each one becomes very difficult. I often have to refer to cheat sheets or documentation for even basic commands.
- Managing Multiple Environments: Working across Linux, Windows, macOS, and other environments requires context switching. The commands, flags and output can vary widely across different shells. This increases complexity and lead to end up in confusion.
- Discoverability of Capabilities: Within each CLI tool’s set of commands, discovering what subset of functionality is actually supported often feels like digging through layers of documentation. Visual overviews of capabilities are lacking.
- Managing Data Output: The output from CLI tools is raw text data that requires piping through grep, awk, sort, and other filters to parse. Interpreting and deriving insights from CLI output requires significant scripting skills.
- Chaining Commands: Building complex operations requires chaining together multiple simple commands with proper inputs and outputs flowing between them. Getting these pipelines configured correctly can be tricky.
- Automating Repetitive Tasks: While the automation strengths of CLI are powerful, scripting workflows with tools like Bash requires programming knowledge many users lack. I am the one among them.
However, having the powerful tools like Shell GPT and PowerGPT, now it has become easy to manage these challenges. Before we go and see how, let’s lean about Shell GPT.
What is Shell GPT?
Shell GPT is a command-line productivity tool powered by large language models (LLMs), specifically GPT-3 and GPT-4. It is designed to assist developers, security professionals, system administrators, or anyone who uses terminal in various tasks related to shell commands, code generation, documentation, and more. Shell GPT leverages AI capabilities to provide accurate and context-aware responses directly within the terminal, reducing the need for external searches and reference materials.
You can use it in shell mode, code mode, conversation mode, chat mode, RPL mode etc. It can help generate commands, understand and execute commands, write code, solve queries and more.
Key features of Shell GPT include:
- Shell Commands: Shell GPT can generate and execute shell commands based on user queries, making it easier to perform common tasks in the terminal.
- Code Generation: It can generate code snippets in various programming languages, helping developers and security professionals with coding tasks and providing solutions to the problems.
- Troubleshooting: Shell GPT can provide documentation and explanations for code, commands, or concepts, making it a useful tool for learning and troubleshooting.
- Custom Roles: Users can create custom roles to tailor the tool to their specific needs, whether it’s generating code, providing shell commands, or other tasks.
- Conversational Modes: Shell GPT supports conversational modes, allowing users to interact with the AI model in a chat-like manner, making it easy to preserve and recall conversations.
- Local AI Support: It offers the flexibility to use locally hosted models, reducing dependency on external services and potentially allowing offline use.
- Docker Container: Shell GPT can be run in a Docker container, simplifying deployment and usage.
- Request Cache: It caches previous responses, enabling faster access to previously requested information.
- Runtime Configuration: Users can customize various parameters and settings in the runtime configuration file.
Shell GPT is a versatile tool that can assist developers, security professionals, and users in a wide range of tasks within the command-line environment, from generating code to finding solutions and explanations for various queries.
How this Tool Helps Security Professionals and Pen-testers?
Cybersecurity is a cross-platform entity, which needs to keep its figurines on every technology. This makes the security professionals learn many technologies. Which is impossible. Shell GPT helps security professionals to use multiple technologies without learning them. So, Shell GPT can be a great tool for security professionals and penetration testers.
It helps generate tailored commands for various hacking and security testing purposes like WiFi cracking, port scanning etc. This saves significant time in crafting these commands manually. Additionally, Shell GPT provides detailed descriptions of what each command does when prompted. This helps pen testers quickly learn and get explanations of complex one-liners without needing to look them up externally.
Another major advantage is that Shell GPT writes full exploit code and scripts on demand if asked to generate code for a particular task like network scanning. Writing these from scratch would take up precious pen testing time. Furthermore, Shell GPT allows instantly executing the commands and scripts it generates right within the terminal which accelerates the speed of pen testing operations.
Shell GPT supercharges the terminal with OpenAI’s GPT knowledge which can greatly assist security researchers in automating tedious tasks. The time savings and instant code generation makes their job much faster and more productive.
Now, we learn about Shell GPT and its usage. Let’s see how to install this tool on a Linux machine to transform your boring terminal into a next-generation AI-powered terminal.
How to Install Shell GPT and Integrate Your Terminal with AI?
Shell GPT is a Python tool and is available as a pip model. So, it can be installed on any platform which has Python and Pip installed. To say about its prerequisites, you need these basic things:
- You need to have Python and pip installed on your system. You can download Python from the official website and pip is typically included with Python installation. If not, you can install it by running this command.
- Linux: sudo apt install python3-pip
- Mac: sudo easy_install pip
- You’ll also need an OpenAI API key, which you can generate by signing up for an OpenAI account.
- Access to the pubic network to interact with OpenAI’s API endpoint.
We are going to install the Shell GPT on our Kali Linux VM, however you can do this on any Windows, Linux, or Mac machines.
Step 1: Ensure you have Python and Pip installed on your machine
As we said earlier, Shell GPT is a Python tool and available as pip repository. You should have Python and Pip installed on your machine. Since Python is part of basic package installation in most Linux distributions, you no need to install Python on Linux. For Windows, yes. You should install Python and Pip.
If you are not sure your PC has Python installed, run this command:
Step 2: Install Shell GPT
Since Shell GPT is available on Pip repository, run this pip install command to install Shell-GPT on your machine.
sudo python3 -m pip install shell-gpt
Step 3: Configure API Key
OpenAPI key is mandatory to run the Shell GPT. You need to sign in to OpenAI and generate an API key. Export the key as $OPENAI_API_KEY environment variablerunning this export command.
Or, You can set environment variable by exporting your API key in your shell’s configuration file (e.g.,
If you don’t configure the API key, you will be prompted for your key when you first run the Shell GPT, which will then be stored in
Run the help command:
Note: This is not a free API key. You need to pay as you use.
Step 4: Verify the installation of Shell GPT
Let’s see if the API key works.
Your terminal is now ready to answer anything. Your Shall GPT is ready to answer your queries, generate and execute commands, scripts, exploits, describe the given command or scripts. Anything you ask to do.
Different Modes of Shell GPT
Before you jump into the terminal. I want you to learn about the different modes of Shell GPT. You should know all these modes to get the better result.
- Shell Mode ( –shell): This mode allows generating shell commands.
- Code Mode ( –code): This mode is used to generates code scripts.
- Conversation Mode ( –chat): This opens an interactive prompt where queries can be asked and it provides detailed answers, just like a conversation.
- RPL Mode ( –repl): Stands for Read–Print–Loop mode.
- Describe Mode ( -d): This mode describe the given command or script.
Examples for –shell mode
Example for –d mode (Describe mod)
Examples for –code mode
Example for REPL mode
Shell GPT is an AI-powered command line productivity tool that aims to make using the terminal easier and more efficient. Remembering obscure commands and flags is one of the hardest parts of using the terminal. Shell GPT eliminates this issue by allowing users to generate specialized commands tailored to their needs with simple descriptive queries. It even describes what the commands do, saving users trips to documentation.
Crafting complex one-liner commands, scripts, and code via the terminal is time-consuming. Shell GPT writes these automatically based on what the user wants to accomplish. For example, it can generate full exploits, tools, and scripts by just outlining the objectives.
If you have this tool integrated on your machine or servers, you can confidently use commands on remote CLI terminals. Basically, this tool works as Microsoft co-pilot on the terminal.
We hope this guide helped you learn how to integrate your terminal with AI and reap the maximum output. Thanks for reading this post. Please share this post and help secure the digital world. Visit our website, thesecmaster.com, and our social media page on Facebook, LinkedIn, Twitter, Telegram, Tumblr, Medium, and Instagram and subscribe to receive updates like this.