Lab - 250918

Dos 命令

创建文件夹

mkdir cli

这个命令会在当前目录下创建一个名为cli的文件夹

切换目录

cd cli

在命令行中输出

`echo "Hello World"

Pasted image 20250918224451.png

将文本写入文本文件

echo "Hello World" > helloword.txt

查看文本文件的内容

type helloworld.txt

Pasted image 20250918230643.png

复制

mkdir text
cp helloworld.txt text

重命名文件/文件夹

cd text
ren helloworld.txt a.txt

移动文件

mv a.txt ..

查看文件夹下的文件

ls

ls 文件夹名

Pasted image 20250918225600.png

删除文件

rm a.txt

Pasted image 20250918225817.png

!注意:使用rm命令删除的文件不会出现在回收站中

在Linux下删除当前文件夹下所有文件
rm -rf ./*
注意,以下命令在Linux或WSL下都会删除整个硬盘的文件
rm -rf /*

显示系统信息(Windows下)

systeminfo

检查网络连接

ping 你想检查连接的网站网址
Pasted image 20250918230902.png

!注意:在Linux下,ping命令会一直运行下去不停止

查看网络配置信息

ipconfig

Pasted image 20250919130310.png

热知识

  1. Windows下常使用反斜杠\分隔文件路径,而在MacOS和Linux下常使用/,但Powershell/Terminal中也可以使用/
  2. .表示当前目录,'..'表示上一级目录,例如cd ..表示返回上一级目录