BlogsHow To Use ChatGPT on Linux

How To Use ChatGPT on Linux

In this article we will talk about the how To Use ChatGPT on Linux. Artificial intelligence is the new big thing, leaving everything else in the dust. There is a lot to look forward to since new things are added every day. People use this tool, which has many uses and is everywhere, to tell jokes, write codes, and even find answers to the strangest questions.

Since ChatGPT is easy to use on other operating systems, why should you, as a Linux user, stay behind?You can also have fun with ShellGPT, ChatGPT’s Linux avatar. Here are a few easy steps for installing and using the AI tool from your Ubuntu terminal.

How To Use ChatGPT on Linux

Start with the Ubuntu update

  • Although here we are going to use PIP, a Python package manager, however, it is good practice to start with the system update command.
  • This not only installs the latest available security package but also rebuilds the APT package manager index cache.
  • So, run: sudo apt update && sudo apt upgrade

Check whether Python3 is available or not

  • ChatGPT and ShellGPT are built using Python.
  • Python language needs to be installed on our Linux system to use ShellGPT.
  • Python version 3 is installed by default on the latest Ubuntu systems.
  • We need to check if Python is installed on our system.
  • python3 -V
  • You will have an output, something like the below:
  • If there is no output, then it would be not installed on your system. Therefore, to get it run the given command:
  • sudo apt install python3

Install Pip Package Manager

  • Developers of ShellGPT made it available through the PIP, which is a popular package manager of Python.
  • PIP is used to manage various dependencies and libraries required by apps written in Python.
  • PIP is not available by default on the Ubuntu Linux system.
  • To install PIP manually, use the following command:
    • sudo apt install python3-pip

Generate OpenAI API key

  • Visit the Open AI Website.
  • You will see Login and Sign up buttons.
  • Those who already have an OpenAI account, can simply press the Login button and enter the login details or use the social mediums available to sign in. Whereas, the rest of the new users need to create an OpenAI account using the Signup link.
  • Once logged-in, from the left side menu, select the API keys given under the USER area.
  • You will see the API keys page of OpenAI.
  • Now, hit the Create new secret key button.
  • A pop-up will appear with your generated API Key. Just copy that and move to the next step.

Add API Key to ShellGPT Configuration file

  • By default, the tool will create a configuration file to control the behavior of ShellGPT. We edit this file to add the API key we have generated.
nano ~/.config/shell_gpt/.sgptrc
  • Add the beginning of the file add:
  • Replace the “your-API-key” with the exact OpenAI APY key you have generated. And to save the file use, Ctrl+X, press Y, and hit the Enter key. See the screenshot for an idea:
  • Ask the Linux terminal to display the amount of free RAM on your system.
  • Use the command sgpt --shell --execute "list free hard disk space and RAM on this system" to list the complete details of the system RAM.
  • Notice that ShellGPT not only provides the commands to fetch the RAM information but also seeks your permission to execute them.


Can you run ChatGPT locally?

We have provided sample code that you can use to interact with the model and generate responses. By hosting ChatGPT locally, you can take advantage of its powerful language processing capabilities without relying on a remote API, which can be more secure and faster.

What is shell GPT?

Shell GPT is a command-line productivity tool powered by OpenAI’s ChatGPT (GPT-3.5), which leverages the language model’s capabilities to help you generate shell commands, code snippets, comments, and documentation, among other things. With Shell GPT, you can forget about cheat sheets and notes.

Why can t ChatGPT access the internet?

Kevin Pocock. ChatGPT is an artificial intelligence system that people use throughout the world. The system’s main use is to generate the answer to any question you ask. Its system does not have any access or connection with the internet, nor does it have any connection with the external data source.

Michael Smith
Michael Smith
Michael Smith, a tech-savvy content editor at Bollyinside. With a knack for simplifying complex tech concepts, Michael specializes in crafting user-friendly "How-to" articles and valuable tips. His focus spans Windows, Mac, hardware, and support. Beyond work, he's an avid explorer of diverse tech fields, constantly staying ahead of the curve.
Trending Today
- Advertisment -