偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

使用 ChatGPT AI 從英文文本生成 Linux 命令

系統(tǒng) Linux 人工智能
我使用的工具叫做 Shell Genie。它是一個命令行工具,可讓你以普通的英語與終端進(jìn)行交互。

即使是專家級的 Linux 用戶也不記得所有的 Linux 命令和它們的選項。這對我們?nèi)祟悂碚f是不可能的。

但是機器呢?尤其是人工智能驅(qū)動的機器?

想象一下,如果你可以“命令”你的終端“顯示過去 12 小時內(nèi)修改過的所有小于 100 MB 的文件”。當(dāng)然,你可以使用 Linux 命令“命令”它,但是用普通的英語進(jìn)行交互呢?

由于人工智能的進(jìn)步,這實際上是可能的。下面是自動生成 Linux 命令以顯示當(dāng)前目錄中所有小于 10 KB 的文件的示例。

Shell Genie AI assistent in Linux terminal

Shell Genie AI assistent in Linux terminal

我使用的工具叫做 Shell Genie。它是一個命令行工具,可讓你以普通的英語與終端進(jìn)行交互。

它可以生成命令、運行命令(如果需要),還可以向你解釋生成的命令。

Shell Genie explain commands

Shell Genie explain commands

Shell-Genie 的特點

  • 將普通英語轉(zhuǎn)換為 Linux 命令。
  • 提供了一個需要 openAI 的 API 密鑰的 openAI gpt3 后端,和一個可以免費使用的 free-genie 后端。
  • 提示一個選項以運行你要求的命令。
  • 解釋生成的命令。

安裝 Shell Genie

Shell-genie 在任何發(fā)行版的默認(rèn)倉庫中都不可用。你可以使用 pipx 安裝它。

要安裝它,你需要安裝 Python 3.10+ 和 Pip。你可以參考我們關(guān)于 如何在 Ubuntu 和其他 Linux 發(fā)行版中安裝 pip 的文章。

安裝 pip 后,使用以下命令安裝 pipx

python3 -m pip install --user pipx
python3 -m pipx ensurepath

An SVG animation showing pipx Installation steps

An SVG animation showing pipx Installation steps

現(xiàn)在,重啟終端并運行以下命令安裝 shell-genie:

pipx install shell-genie

這可能顯示錯誤或需要依賴項。

A dependency installation to install the shell-geie properly

A dependency installation to install the shell-geie properly

運行提示的命令來安裝所需的依賴。在我的例子中:

sudo apt install python3.10-venv

之后,再次運行 shell-genie 安裝命令,就可以安裝了。

The steps showing the installation of shell-genie

The steps showing the installation of shell-genie

安裝完成后,運行以下命令:

shell-genie init

這將要求你選擇后端,openAI 或 free-genie。如果你有 openAI API,你可以選擇它或繼續(xù)使用 free-genie。

?? free-genie 后端可能并不總是工作,因為它是由開發(fā)者托管的,他警告說可能會出現(xiàn)中斷。

然后它將請求允許報告反饋。用 y/n 來決定。

Run shell-genie init commad to set up the shell-genie properly

Run shell-genie init commad to set up the shell-genie properly

現(xiàn)在就可以使用了。

使用 Shell-genie

?? 如果你要進(jìn)行實驗,請盡量不要使用帶有 sudo 或刪除文件的命令。不要將你的機器交到機器手中。

如上所述,shell-genie 提供了兩種工作模式:

  • 從普通的英語獲取命令
  • 獲取命令解釋

從普通英語中獲取 Linux 命令

你可以使用 shell-genie 的 ask 選項從普通的英語中獲取命令。例如:

shell-genie ask "Display only the folders of this directory"

這將顯示正確的命令,并提示我們是否運行該命令。

The working of shell-genie, that will print the required command from the provided plain text description. Also propt the user to execute the same or not

The working of shell-genie, that will print the required command from the provided plain text description. Also propt the user to execute the same or not

獲取帶解釋的 Linux 命令

你可以使用 shell genie 來解釋你要運行的一些命令。

shell-genie ask "display all files smaller than 10kb in here" --explain

上面的命令首先會顯示需要的命令并進(jìn)行解釋,然后提示用戶是否執(zhí)行。

The explain mode in shell-genie, where it will explain the command that was asked in the form of plain english and then prompts the user to execute it or not

The explain mode in shell-genie, where it will explain the command that was asked in the form of plain english and then prompts the user to execute it or not

總結(jié)

有像 Explain Shell 這樣的工具(試圖)解釋 Linux 命令。但是這個 Shell genie 通過從普通的英語生成命令將它提升到一個新的水平。

當(dāng)然,不能一味依賴人工智能。如果你對 Linux 命令有一定的了解,可以使用 Shell Genie 生成適合你的命令。你不必為手冊頁或各種網(wǎng)站而苦惱。

它可以幫助你在終端中更快地做事,也可以減少你的知識儲備。為什么? 因為你越依賴它,你自己學(xué)的就越少。

(題圖:MJ/chatgpt commands linux cli illustration in high resolution, very detailed, 8k)

責(zé)任編輯:龐桂玉 來源: Linux中國
相關(guān)推薦

2018-03-27 13:33:48

百度

2023-02-06 10:12:04

人工智能文本生成工具

2022-11-21 17:44:03

機器學(xué)習(xí)文本生成器自然語言

2024-09-30 09:04:20

2023-08-04 17:33:27

Meta音頻AI

2023-02-28 11:19:35

CHATGPT人工智能

2018-04-08 09:02:00

CGIHTML動態(tài)網(wǎng)站

2023-05-29 12:13:58

模型AI

2023-03-15 10:37:21

OpenAIChatGPT

2022-12-14 14:09:47

AIChatGPT筆記

2022-08-03 13:52:22

AI建筑師

2024-05-29 10:31:52

2023-06-19 07:08:22

結(jié)構(gòu)化數(shù)據(jù)ChatGPT

2023-03-07 13:50:54

2023-02-20 16:29:45

開發(fā)AI

2025-01-26 09:30:00

AI模型框架

2024-02-19 09:19:54

OpenAIAI模型人工智能

2021-02-01 10:11:04

工具代碼開發(fā)

2023-05-22 10:53:53

點贊
收藏

51CTO技術(shù)棧公眾號