Software, settings, next steps
Linux & the command line Lesson 14 2:27 English narration · English + 中文 subtitles burned in
Chapters
Transcript
On Linux you almost never download an installer.
在 Linux 上你几乎从不下载安装程序。
A package manager fetches software for you, from a checked source.
包管理器替你去取软件,从一个受检查的来源。
The same idea has different names on different systems — apt on Debian and Ubuntu, dnf on Fedora, brew on macOS.
同一个概念在不同系统上有不同的名字—— Debian 和 Ubuntu 上是 apt,Fedora 上是 dnf,macOS 上是 brew。
One command, and the tool arrives along with everything it needs to run.
一条命令,那个工具就到了,连同它运行所需要的一切。
The shell remembers settings in environment variables, and the one that matters most is PATH.
shell 把设置记在环境变量里,而其中最要紧的一个是 PATH。
It is a list of folders, separated by colons.
它是一串文件夹,用冒号分开。
When you type l s, the shell looks in each of them in turn until it finds a program of that name.
当你敲 ls 时,shell 会依次在它们每一个里面找,直到找到一个同名的程序。
That also explains a message you will meet: a program you just wrote is "not found" until its folder is on PATH.
这也解释了你会遇到的一条消息: 你刚写好的一个程序会显示"未找到",直到它所在的文件夹被加进 PATH。
Your own settings live in a file called dot bashrc, in your home folder.
你自己的设置放在家目录里一个叫 .bashrc 的文件里。
It runs every time a shell starts, so anything you put there is permanent — an alias that turns two letters into a long command, or a folder added to PATH.
每次 shell 启动它都会运行,所以你放进去的东西是长久的—— 一个把两个字母变成一条长命令的别名,或者一个加进 PATH 的文件夹。
An alias you add today is still there tomorrow, and on every terminal you open.
你今天加的别名,明天还在,而且你打开的每一个终端里都在。
And here is the point of the whole course, on a list of installed packages.
而这里就是整门课的要点,展示在一份已安装软件包的清单上。
Sort it, take the first three, count the lot — those are the commands from lesson ten, and nobody wrote them with package lists in mind.
给它排序、取前三行、数一数总数—— 那些就是第 10 课里的命令,而没有人是为软件包清单写它们的。
They work because it is lines of text, and almost everything on a Linux machine is lines of text.
它们之所以管用,是因为这是一些文本行, 而 Linux 机器上几乎所有东西都是文本行。
Three things to learn next.
接下来该学三样东西。
Git, to keep the history of your work.
git,用来保存你工作的历史。
An editor such as nano or vim, so you can change a file without leaving the terminal.
一个编辑器,比如 nano 或 vim,好让你不离开终端就能改文件。
And a little shell scripting, so you can save a pipeline you liked as a command of your own.
再加一点点 shell 脚本,好把你喜欢的某条管道存成你自己的一条命令。
Beyond that, keep a real terminal open and use it for small jobs: speed comes from habit, not from knowing more commands.
除此之外,保持一个真实的终端开着,用它做些小事: 速度来自习惯,而不是来自认识更多的命令。
Four things to take with you.
带走四点。
One: a package manager installs software and its dependencies.
第一:包管理器会连同依赖一起把软件装上。
Two: PATH is the list of folders the shell searches.
第二:PATH 是 shell 要搜索的那串文件夹。
Three: dot bashrc holds settings and aliases of your own.
第三:.bashrc 存放你自己的设置和别名。
Four: the tools you learned work on ANY lines of text.
第四:你学到的这些工具适用于任何文本行。
Do the tasks — and that is the course.
做完题目——这门课就结束了。
Well done.
做得好。