# Using GPT 3.5 in the command line

I am someone who works a lot with command line programs like terminal or bash. The biggest pain point for me is not remembering a command or options for a command.

Thankfully, I have found a solution – using GPT-3 in the command line.

Let me show you how

We will take a closer tool called plz that uses GPT-3 to convert English into actual commands. We will see how to install it and go through some use cases.

Let’s go.

Table of Contents

*   [Installation](https://harishgarg.com/#Installation)
*   [Configuration](https://harishgarg.com/#Configuration)
*   [Using plz](https://harishgarg.com/#Using_plz)
*   [Getting help](https://harishgarg.com/#Getting_help)
*   [Examples](https://harishgarg.com/#Examples)
    *   [Automating frequent tasks](https://harishgarg.com/#Automating_frequent_tasks)
    *   [Setting up a development environment](https://harishgarg.com/#Setting_up_a_development_environment)
*   [Conclusion](https://harishgarg.com/#Conclusion)

Installation
------------

To install plz, run the following command in your terminal:

`curl -fsSL https://raw.githubusercontent.com/m1guelpf/plz-cli/main/install.sh | sh -   `

Alternatively, you can download the binary for your operating system (OS) from the latest release.

After installation, you may need to close and reopen your terminal.

Configuration
-------------

To use plz, you’ll need to grab an API key from your OpenAI https://beta.openai.com/account/api-keys.

Save the key to OPENAI\_API\_KEY as follows

export OPENAI\_API\_KEY=’sk-XXXXXXXX’

You can also save it in your bash/zsh profile for persistence between sessions.

Using plz
---------

To use plz, run the plz command followed by a description of the task you want to perform.

For example, to get a list of all available options for the plz CLI, you could run the following command:

plz “show me command and options for moving a directory”

Getting help
------------

To get a full overview of all available options, you can run `plz --help`.

$ plz –help  
Generates bash scripts from the command line

Usage: plz \[OPTIONS\] <PROMPT>

Arguments:  
<PROMPT> Description of the command to execute

Options:  
\-y, –force Run the generated program without asking for confirmation  
\-h, –help Print help information  
\-V, –version Print version information

Examples
--------

Here are a few examples of how plz can be used to automate tasks and streamline your workflow.

### Automating frequent tasks

You can use plz to generate scripts that automate tasks that you perform frequently. For example, you might use plz to generate a script that creates a new directory, copies some files into it, and then pushes the directory to a remote repository.

To do this, you could run the following command:

`$ plz "Create a new directory called 'project', copy the files 'file1.txt' and 'file2.txt' into it, and then push the directory to the remote repository 'origin'"`

plz would then generate a script that performs these tasks, which you could then run with the `-y` flag to execute it without requiring confirmation.

### Setting up a development environment

You can also use plz to generate scripts that perform more complex operations, such as setting up a development environment or deploying a web application. For example, you could use plz to generate a script that installs all the necessary dependencies, sets up a virtual environment, and then runs the application.

To do this, you could run the following command:

`$ plz "Set up a development environment for a Python web application, including installing dependencies, setting up a virtual environment, and running the application"`

plz would then generate a script that performs these tasks, which you could then run with the `-y` flag to execute it without requiring confirmation.

Conclusion
----------

In conclusion, GPT-3/GPT3.5 is a powerful AI tool that can help you auto-generate shell scripts from English.

It can help a developer looking to set up a development environment. It can also help a system administrator looking to automate tasks,

GPT-3 can help you get things done faster.
