Get Linux commands in natural language with the power of ChatGPT.

  • By asrul10
  • Last update: Jul 20, 2023
  • Comments: 5

Linux Command GPT (lcg)

Get Linux commands in natural language with the power of ChatGPT.

Installation

Build from source

> git clone --depth 1 https://github.com/asrul10/linux-command-gpt.git ~/.linux-command-gpt
> cd ~/.linux-command-gpt
> go build -o lcg
# Add to your environment $PATH
> ln -s ~/.linux-command-gpt/lcg ~/.local/bin

Or you can download lcg executable file

Example Usage

> lcg I want to extract linux-command-gpt.tar.gz file
Completed in 0.92 seconds

tar -xvzf linux-command-gpt.tar.gz 

Do you want to (e)xecute, (r)egenerate, or take (N)o action on the command? (e/r/N): 

Options

> lcg [options]

--help         output usage information
--version      output the version number
--update-key   update the API key
--delete-key   delete the API key

Download

linux-command-gpt.zip

Comments(5)

  • 1

    Raspberry Pi 4 support?

    After completing steps from installation lcg doesn't work. My go installation is for arm64 and it works and completes the build command. But after creating a symlink when I try to run the command I get "command not found" or when in ~/.linux-command-gpt it says "cannot execute binary file".

  • 2

    Feature proposal: (R)e-generate command

    The current

    Are you sure you want to execute the command? (Y/n):
    

    Should be

    Are you sure you want to execute the command? (Y/n/r):
    

    Where 'r' sends the question again to chatGPT to generate a new answer.

  • 3

    Feature request (usability improvement): When lcg is called withiut any argument, ask for it

    Currently, when we run gptc, this is displayed

    Usage: lcg [options]
    
      --help         output usage information
      --version      output the version number
      --update-key   update the API key
      --delete-key   delete the API key
    

    It would be ideal to prompt the user to enter text.

  • 4

    Add a feature to regenerate the result and some minor improvements

    • [x] There will be three options after getting the result: (e)xecute, (r)egenerate, and (N)o action.
    • [x] The default option will be (N)o action instead of (e)xecute.
    • [x] Remove the box surrounding the result to make it easier to select and copy the command.
    • [x] Show example usage if there is no option

    This pull request addresses issue #5 #7

  • 5

    some commands not working

    great work here. I have noticed commands such as 'cd' and 'cat' not working. For example, with 'cd', I get:

    exec: "cd": executable file not found in $PATH

    and with 'cat', I get:

    exit status 1

    When I run the proposed commands in a separate terminal, they all work properly. I'm just starting to use the tool, and most other commands are working well directly from your program. I think your tool has great potential as a self-learning tool for linux beginners or even more experienced users, since it acts as an interface between the users' thoughts and the appropriate terminal command.