The shell and the prompt
Linux & the command line Lesson 1 2:00 English narration · English + 中文 subtitles burned in
Chapters
Transcript
When the terminal is ready it shows a prompt and waits.
当终端准备好时,它会显示一个提示符然后等着。
Most people look straight past it, and it is already telling you three things.
大多数人看都不看它一眼,而它其实已经告诉了你三件事。
The first word is who you are — your user name.
第一个词是"你是谁"——你的用户名。
After the at sign is which computer you are on.
@ 后面是"你在哪台机器上"。
After the colon is which folder you are in, and a tilde means your home folder.
冒号后面是"你在哪个文件夹里",而波浪号表示你的家目录。
And the dollar sign marks where you type.
而那个美元符号标出了你输入的地方。
Your first real command answers "where am I?".
你的第一条真正的命令回答"我在哪里?
Type p w d — print working directory — and the shell answers with the full path of the folder you are standing in.
"。 输入 pwd——print working directory—— shell 会用你所站的那个文件夹的完整路径来回答。
Slash home slash student.
/home/student。
And now the tilde in the prompt makes sense: it is short for exactly this folder.
现在提示符里那个波浪号就说得通了:它就是这个文件夹的简写。
The classic first command is echo, which simply prints back whatever you give it.
经典的第一条命令是 echo,它只是把你给它的东西原样打印出来。
Type echo hello from the shell and hello from the shell comes back.
输入 echo Hello from the shell,回来的就是 Hello from the shell。
Try echo two plus two and you get the characters two plus two — echo does not calculate, it repeats.
试试 echo 2 + 2,你得到的是"2 + 2"这几个字符—— echo 不做计算,它只是重复。
That is exactly the point: it shows you what the shell actually received.
而这恰恰就是重点:它让你看到 shell 实际收到了什么。
One thing to know before you start typing.
在你开始敲之前要知道一件事。
Commands are case-sensitive.
命令是区分大小写的。
Capital L capital S is not a command at all — the shell says command not found, and nothing is being helpful about it.
大写的 LS 根本不是一条命令——shell 会说"命令未找到", 而且它不会替你想办法。
Lower-case l s works.
小写的 ls 才行。
And the shell runs one command per line, when you press Enter.
而 shell 是一行一条命令地运行,在你按下回车的时候。
Four things to take with you.
带走四点。
One: the prompt names you, the computer and your folder.
第一:提示符写出了你、这台机器和你所在的文件夹。
Two: a tilde is short for your home folder.
第二:波浪号是家目录的简写。
Three: p w d prints the folder you are in.
第三:pwd 打印你所在的那个文件夹。
Four: commands are case-sensitive.
第四:命令区分大小写。
Now type the tasks into the terminal below.
现在把下面那些题目敲进终端里。