Creating and removing · 创建与删除
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
English
Making things
mkdirmakes a directory;touchmakes an empty file:
- After these, you have a
notesfolder with an emptytodo.txtinside it.
中文
创建
mkdir创建目录;touch创建一个空文件:
mkdir notes
touch notes/todo.txt
- 执行后,你就有了一个
notes文件夹,里面有一个空的todo.txt。
English
Copying and moving
cpcopies a file;mvmoves (or renames) it:
mv old newis also how you rename something — moving it to a new name.
中文
复制与移动
cp复制文件;mv移动(或重命名)文件:
cp hello.txt backup.txt
mv backup.txt notes/backup.txt
mv 旧名 新名也是重命名的方法 —— 把它移动到一个新名字。
English
Removing — carefully
rmremoves a file. To remove a folder and everything in it, add-r(recursive):
- ⚠️ There is no recycle bin on the command line.
rmis permanent — always check before you delete.
中文
删除 —— 要小心
rm删除文件。要删除一个文件夹及其中的所有内容,加上-r(递归):
rm backup.txt
rm -r notes
- ⚠️ 命令行里没有回收站。
rm是永久性的 —— 删除前一定要确认。
English
Common mistakes
rmdeletes for good — there is no recycle bin.mkdirmakes a folder;rmdironly removes an empty one.
中文
常见错误
rm永久删除——没有回收站。mkdir新建文件夹;rmdir只能删空的。
Explore · 探索
Folders and files · 文件夹和文件
mkdir / touch add to the tree; cd moves where you are. · mkdir / touch 往树里添加;cd 改变你所在的位置。
Make a new folder called notes with mkdir notes. The check then lists the folder to confirm it appeared. · 用 mkdir notes 新建一个名为 notes 的文件夹。检查时会列出该目录,确认它出现了。
Make a copy of hello.txt named backup.txt using cp. · 用 cp 把 hello.txt 复制一份,命名为 backup.txt。