• Using ChatGPT in the Linux terminal is not only possible. It is also highly recommended
  • You can integrate AI into this operating system and it will work just as well or better than others
  • What are the steps to follow to enjoy Artificial Intelligence in Linux and how to improve it?

Artificial Intelligence continues to advance by leaps and bounds and more and more are seeking to take advantage of it. Today, and at the request of the readers, we show you how can you use ChatGPT in linux terminal. We are talking about an important trick for all those users who opt for this alternative operating system.

The first thing you need to know about it is that it is possible to use ChatGPT on Linux thanks to the possibilities available within the GitHub repositories, and there are several interesting ones although we will focus on one.

This is the adaptation of ChatGPT that is available at this link from user slithery.

It is essential to clarify that each project has its own characteristics and that they are not necessarily similar. Therefore, if you choose another, it is likely that you will notice some differences with respect to the one we are analyzing in this case.

Advantages of using ChatGPT in the Linux terminal

Currently, the best way we can bring ChatGPT’s AI to Linux is through the terminal.

For those who don’t know, this terminal is as fast and practical as any web browser or even more. Instantly accessible once it’s set up, you can get to it with just a keyboard shortcut.

On the other hand, in our tests we have noticed that the response speed is better than on the official website. It can also help that you don’t need to log in so no personal data is exposed.

As if that were not enough, since there is no word limit, we avoid the problem of incomplete long answers.

Artificial Intelligence in the Linux terminal, step by step

Get the ChatGPT API

To achieve our goal, it is essential to have an API key what can you get in this link. Inside, log in with your ChatGPT account and, in the API Keys section, press + Create new secret key. The API key composed of endless numbers and letters combined.

You cannot share this key with anyone or you will put your security at risk. Besides, Since this ChatGPT API is not free but you have to pay for it, you have an initial balance of 18 dollars as a trial.

Install ChatGPT on Linux

With the API in your possession, you must proceed to install ChatGPT-cli. You can do it through Python.

The first thing is to install the necessary dependencies by running the command sudo apt install python3-pip python3-venv. After that, create the directory /home/joan/chatgpt inside which the Python virtual environment packages will go. Now create the python virtual environment by running the command python3 -m venv /home/joan/chatgpt.

The next step is to activate the environment you just created with the command /home/joan/chatgpt/bin/activate. Once the process is finished, you can install chatgpt-cli with the command pip3 install chatgpt-cli-tool python-dotenv openai.

Start ChatGPT on Linux

You are now ready to start ChatGPT on Linux for the first time, with the command chatgpt-cli and the API number. It will appear on the screen and you will be able to interact with it without any problem, just as if you were on MacOS/Windows.

How to improve the AI ​​of ChatGPT on Linux?

There are numerous ways in which you can improve the performance of Artificial Intelligence in Linux. It will all depend on what your interests are with this technology, but let’s go over some good ideas.

Open chatgpt-cli with a keyboard shortcut

Keyboard shortcuts are never superfluous, and in this specific case we can develop one to launch chatgpt-cli. Basically, you have to make a script to start chatgpt-cliand these are the steps you must follow:

mkdir -p ~/Aplicaciones

Enter the directory

cd ~/Aplicaciones

Create the script by running this command

nano chatgpt.sh

Paste the following code in the text editor

source ~/chatgpt/bin/activate
python3 ~/chatgpt/bin/chatgpt-cli

Save the changes, close the file and grant execution permissions to the script

chmod +x ~/Aplicaciones/chatgpt.sh

Finally, configure the i3 desktop to run the script you created with the Win + I keyboard shortcut

nano ~/.config/i3/config

When opening the configuration file, add this line

bindsym $mod+i exec kitty -e /home/joan/Aplicaciones/chatgpt.sh

Do not forget that if you do not use the Kitty terminal you have to adapt the command to the terminal you are using. Once the configuration has been modified, it would be necessary to save the changes, close the file and restart the computer. Now turned on again, pressing the Win + I keys will open ChatGPT in Linux and you will be able to interact with this intelligence.

Have you managed to use ChatGPT in the Linux terminal? How was your experience with AI?

Write A Comment