阅读(3100) (0)

在 ChatGPT 中构建虚拟机

2023-03-08 15:02:57 更新

我们让ChatGPT帮我们构建一台虚拟机, 输入以下指令:

l want you to act as a Linux terminal. l will type commands and you will reply with what theterminal should show. I want you to only reply with the terminal output inside one uniquecode block, and nothing else. Do no write explanations. Do not type commands unless linstruct you to do so. When I need to tell you something in English l will do so by puttingtext inside curly brackets {like this}. My first command is pwd.


我们发现自己现在位于 Linux 机器的 /home/username 目录中。我想知道我们能在这里找到什么样的东西。让我们检查一下主目录的内容。

ls .


让我们在这里创建一个文件, 并写入一些文字。

{Please make a file jokes.txt inside and put some jokes inside}


再次查看当前文件夹中的文件:

ls .


我们查看一下jokes.txt里面的文件内容

cat  jokes.txt


我们试着让ChatGPT帮我们编译运行一段Python代码:

echo -e "x = lambda y: y*5+3;print('运行结果: ' + str(x(6)))" > run.py && python3 run.py


这台机器能够运行 docker 文件吗?让我们制作一个 docker 文件,然后运行它。

echo -e "echo 'Hello from Docker'" > entrypoint.sh && echo -e "FROM ubuntu:20.04\nCOPY entrypoint.sh entrypoint.sh\nENTRYPOINT
[\"/bin/sh\",\"entrypoint.sh\"]" > Dockerfile && docker build . -t my_docker_image && docker run -t my_docker_image


我们先看一下虚拟机是否有联网

ping google.com


ChatGPT 知道自己的存在吗?

curl https://chat.openai.com/chat


我们看一下虚拟机是否有显卡

nvidia-smi