Software, settings, next steps
此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
安装软件
- 在 Linux 上,你很少需要下载安装程序。包管理器会替你获取并安装软件。
- Debian 和 Ubuntu 用
apt;Fedora 用dnf;macOS 用户常常会装一个brew:
sudo apt update
sudo apt install git
- 一条命令,这个工具(以及它所需要的一切)就装好待用了。
探索
Installing with a package manager
apt update refreshes the catalogue, apt install fetches the tool and its needs.
环境
- shell 把各种设置记在环境变量里。其中最重要的是
PATH—— 它列出 shell 查找命令时要搜索的文件夹。 - 对于交互式非登录 Bash shell,个人启动命令通常位于
~/.bashrc。登录 shell 和其他 shell 使用不同的启动文件。别名和启动文件编辑不在本模拟器范围内。
下一步去哪儿
- 现在你已经会浏览、读取、搜索、组合和管理文件了 —— 这正是命令行的核心。
- 让一个真实的终端常开着,用它来处理小任务;熟能生巧,速度自然就来了。
- 接下来可以学:用于版本控制的
git、像nano或vim这样的文本编辑器,以及一点shell 脚本,把你常用的命令自动化。做得好!
现在轮到你
apt需要真实的网络,所以不在我们的模拟器里 —— 但一份已安装软件包的清单保存在installed.txt里。- 用本课学到的工具
sort给清单排序,用wc数一数数量。同样这几条命令对任何文本数据都管用。
常见错误
- 使用不熟悉的选项前,先读命令的
--help或man手册。 - 危险的命令先在文件副本上测试。
难度 3/5 · 今日首次完成可获 200 金币及少量额外奖励
apt list --installed is a real command, not part of our simulator — but here its output is saved in installed.txt. Put the package names in alphabetical order with sort installed.txt.
难度 3/5 · 今日首次完成可获 200 金币及少量额外奖励
How many packages are installed? Count the lines with cat installed.txt | wc -l — the same file tools work on any data.
难度 3/5 · 今日首次完成可获 200 金币及少量额外奖励
Is a Python package installed? Search installed.txt for the text py with grep.