Nvidia Unveils Futuristic Gaming Experience at Computex 2023
News

Nvidia Unveils Futuristic Gaming Experience at Computex 2023, Blending Gaming and AI

by Isabel
May 29, 2023
0

At Computex 2023, Nvidia displays a futuristic gaming experience that...

Read more
Adobe Introduces Powerful Generative AI Tools in Photoshop

Adobe Introduces Powerful Generative AI Tools in Photoshop Beta

May 29, 2023
Adobe Photoshop's Generative Fill Feature

Exploring the Power of Adobe Photoshop’s Generative Fill Feature

May 27, 2023
NVIDIA and Microsoft Partner to Accelerate AI

NVIDIA and Microsoft Partner to Accelerate AI

May 25, 2023
google photos security and privacy

Exploring the Top 5 Privacy and Security Risks of using Google Photos

May 24, 2023
Chatsonic Advanced AI chatbot

Chatsonic Advanced AI Chatbot

May 3, 2023
How to Use ChatGPT in Linux Terminal

How to Use ChatGPT in Linux Terminal

May 19, 2023
Google I/O 2023

A New Update on Google I/O 2023 event

May 12, 2023
How Humans Can Keep Up With AI: Strategies for Thriving in a Rapidly Changing World

How Humans Can Keep Up With AI: Strategies for Thriving in a Rapidly Changing World

February 16, 2023
GPT4free chatbot

GPT4Free-Python based Discord Chatbot

May 5, 2023
Automatic Prompt Engineering

Advanced Prompt Engineering Guide

May 10, 2023
Cloudbooklet
  • News
  • Artificial Intelligence
  • Linux
  • Google Cloud
  • AWS
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Linux
  • Google Cloud
  • AWS
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home Artificial Intelligence

How to Use ChatGPT in Linux Terminal

by Hollie
May 19, 2023
in Artificial Intelligence, Linux
Reading Time: 7 mins read
How to Use ChatGPT in Linux Terminal
Share on FacebookShare on TwitterShare on WhatsAppShare on Telegram

OpenAI’s ChatGPT is a powerful language model. ChatGPT’s capacity to recognize and create human-like writing offers up new opportunities for interactive discussions and information retrieval. In this post, we will look at how you can use ChatGPT straight from your Linux terminal, giving you a flexible AI assistant at your disposal.

Table of Contents

  1. What Is ShellGPT for Linux?
  2. Install Python 
  3. Install and Set Up a Virtual Environment Using Python
  4. Get Your OpenAI API Key
  5. Add and Verify the API Key into a Virtual Environment Variable
  6. Install ShellGPT on Ubuntu

What Is ShellGPT for Linux?

ShellGPT is a command line version of ChatGPT that allows users to interact with the AI chatbot directly from their Linux terminal. It is based on OpenAI’s GPT big language model (for more information on OpenAI’s latest GPT-4 model, see here).

You might also like

ChatGPT app

The Easiest Way to Download ChatGPT App Free

May 31, 2023
LLM Connected with APIs

Gorilla: LLM Connected with APIs

May 31, 2023

ShellGPT can provide intelligent suggestions and recommendations depending on your text input, and it can even run shell commands. It also learns from your interactions and improves with time. Users no longer need to input long instructions or memorize difficult Linux Terminal commands with this ChatGPT utility baked into the command line.

Install Python 

ShellGPT, like other artificial intelligence-enabled programs, is written in Python. While Python is normally installed by default on most Linux distributions, you may check its version information to see if it is installed. If Python isn’t already installed on your PC, you must do so before proceeding.

To verify Python’s version, open a terminal and enter the following commands:

python3 --version

Now that Python is installed on your system, you may install PIP, Python’s native package management.

Despite the fact that PIP is normally pre-installed with the Python bundle, it is best to verify the version beforehand to determine the condition of its installation. To see if it is installed on your PC, use the following command:

sudo apt-get -y install python3-pip

Once installed, use the following command to verify the Pip version on Linux:

pip3 --version

Install and Set Up a Virtual Environment Using Python

Now that Python and PIP are installed, you may configure Python’s virtual environment to prepare the computer for installing and executing ShellGPT. Because they minimize library conflicts, virtual environments are great for executing isolated programs.

You may use a virtual environment to prevent interactions between your system’s and virtual environment’s applications while executing distinct executions in silos.

Install the venv module to establish a virtual environment in Python:

sudo apt install python3-venv -y

Set up the Environment.

Now that you’ve covered the prerequisites, let’s set up the environment for accessing ChatGPT from your Linux terminal using the following steps:

1. To begin, launch the terminal from the app’s menu or use the “Ctrl + Alt + T” keyboard shortcut.

2. Now, use the command below to create a new directory and arrange all of the files.

mkdir <your_directory_name>

For example, we used the following command to create a new directory called “commandline-chatgpt”:

mkdir commandline-chatgpt

3. Use the “change directory” command to navigate to the new directory you just created:

cd <new_directory_name>

In the following example, we’ve navigated to the commandline-chatgpt directory, where we’ll set up the environment to utilize ChatGPT in the Linux terminal:

cd commandline-chatgpt

4. Now, use the venv module to establish a virtual environment with the command below. The name “chatgpt_cli” was chosen for our virtual environment.

python3 -m venv <virtual_environment_name>

5. By default, the virtual environment you just established will be inactive. Use the following command to activate the environment:

source <virtual_environment_name>/bin/activate

When you run the mentioned command, the shell prompt will display the name of the virtual environment in brackets, as seen below:

(<virtual_environment_name>)<username>@<system_name>

Get Your OpenAI API Key

You must link the OpenAI services and your Ubuntu computer to execute ShellGPT now that the virtual environment is ready. You must first go to the OpenAI website and register an account there.

If you already have an account, log in and browse to your profile image, which is placed on the upper right-hand side of the page.

Click View API Keys, then Create new secret key.

This key should not be shared with anybody since the connection is private and should only be utilized on your system.

Because you won’t be able to review the same API key again, copy it from the dialog box and store it elsewhere.

ChatGPT

To connect to your Ubuntu system, use the export command to create an environment variable:

export OPENAI_API_KEY=<your_OpenAI_API_key_here>

Add and Verify the API Key into a Virtual Environment Variable

When you execute the API key in this manner, Linux will use it only for a single instance. However, if you want to make the execution permanent, save it in the .bashrc file.

All you have to do is type in the first command and enter the subsequent command within the text editor:

nano ./bashrc
export OPENAI_API_KEY=<paste key details here>

Save your work and quit the editor. Then, use the source command to make the changes.

source ./bashrc

Finally, use the env command to validate the API key.

env

Install ShellGPT on Ubuntu

Once the installation is complete, you may proceed to the ShellGPT installation. The installation procedure is simple, and the utility may be installed with the following command:

pip3 install shell-gpt

Also read: ChatGPT iOS App: A Powerful AI Chatbot for Your Mobile Device

This article is to help you learn about how to use ChatGPT in a Linux Terminal. We trust that it has been helpful to you. Please feel free to share your thoughts and feedback in the comment section below.


Tags: ChatGPTLinux windows
Share2Tweet1SendShare
Hollie

Hollie

Help us grow and support our blog! Your contribution can make a real difference in providing valuable content to our readers. Join us in our journey by supporting our blog today!
Buy me a Coffee

Related Posts

Soundstorm-Pytorch

Soundstorm-Pytorch: A Powerful Tool for Audio Generation

May 30, 2023
Midjourney vs Adobe Firefly

Midjourney vs Adobe Firefly: A Comparison of Two AI Image Generation Tools

May 30, 2023
ChatGPT

How to Use ChatGPT Code Interpreter

May 31, 2023
Leonardo AI Login

How to login and use Leonardo AI to generate high-quality image

May 30, 2023

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

  • Trending
  • Comments
  • Latest
DragGAN The AI-Powered Image Editing Tool

DragGAN: The AI-Powered Image Editing Tool That Makes Editing Images Easy

May 30, 2023
DragGAN AI editing Tool Install and Use DragGAN Photo Editor

DragGAN AI editing Tool Install and Use DragGAN Photo Editor

May 27, 2023
Bard API key

Everything You Need to Know About Google’s Bard API Key

May 20, 2023
Install PHP 8.1 on Ubuntu

How to Install or Upgrade PHP 8.1 on Ubuntu 20.04

May 17, 2023
DragGAN The AI-Powered Image Editing Tool

DragGAN: The AI-Powered Image Editing Tool That Makes Editing Images Easy

75
Upgrade PHP version to PHP 7.4 on Ubuntu

Upgrade PHP version to PHP 7.4 on Ubuntu

28
Install Odoo 13 on Ubuntu 18.04 with Nginx - Google Cloud

Install Odoo 13 on Ubuntu 18.04 with Nginx – Google Cloud

25
Best Performance WordPress with Google Cloud CDN and Load Balancing

Best Performance WordPress with Google Cloud CDN and Load Balancing

23
How to Setup SSH Keys on Ubuntu

How to Setup SSH Keys on Ubuntu 20.04

May 31, 2023
ChatGPT app

The Easiest Way to Download ChatGPT App Free

May 31, 2023
LLM Connected with APIs

Gorilla: LLM Connected with APIs

May 31, 2023
Soundstorm-Pytorch

Soundstorm-Pytorch: A Powerful Tool for Audio Generation

May 30, 2023

Popular Articles

  • DragGAN The AI-Powered Image Editing Tool

    DragGAN: The AI-Powered Image Editing Tool That Makes Editing Images Easy

    1436 shares
    Share 574 Tweet 359
  • DragGAN AI editing Tool Install and Use DragGAN Photo Editor

    332 shares
    Share 133 Tweet 83
  • Auto-Photoshop-Stable Diffusion-Plugin: A New Way to Create AI-Generated Images in Photoshop

    70 shares
    Share 28 Tweet 18
  • InternGPT: A New Way to Interact with ChatGPT

    54 shares
    Share 22 Tweet 14
  • Midjourney vs Adobe Firefly: A Comparison of Two AI Image Generation Tools

    10 shares
    Share 4 Tweet 3
Cloudbooklet

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Linux
  • Google Cloud
  • AWS

Cloudbooklet © 2023 All rights reserved.

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.