The shell and the prompt · shell 与提示符
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
The prompt
- When the terminal is ready, it shows a prompt and waits:
- That tells you who you are (
student), the computer (linux), and the folder you are in (~, your home). - You type a command after the
$, press Enter, and the computer runs it.
中文
提示符
- 终端准备就绪时,会显示一个提示符并等待:
student@linux:~$
- 它告诉你:你是谁(
student)、这台计算机(linux),以及你所在的文件夹(~,即你的主目录)。 - 你在
$后面输入命令,按下回车,计算机就会运行它。
English
Where am I?
- The command
pwdprints your current folder — your "you are here" on the map:
- Press the ▶ on that example to try it. (
~is short for your home folder,/home/student.)
中文
我在哪里?
- 命令
pwd会打印你的当前文件夹 —— 也就是地图上的“你在这里”:
pwd
- 按那个示例上的 ▶ 试试看。(
~是你主目录/home/student的简写。)
English
Make the computer talk
echosimply prints back what you type. It is the classic first command:
- Run it, then try the two tasks below.
中文
让计算机说话
echo会把你输入的内容原样打印出来。它是经典的第一个命令:
echo Hello from the shell
- 运行它,然后试试下面的两个任务。
English
Common mistakes
- Commands are case-sensitive:
LSis notls. - The shell runs one command per line when you press Enter.
中文
常见错误
- 命令区分大小写:
LS不是ls。 - 按回车时,shell 每行运行一条命令。
The prompt is waiting for a command. Type pwd (print working directory) to see which folder you are in, then click Run. · 提示符正在等待命令。输入 pwd(print working directory,打印当前目录)来看看你在哪个文件夹,然后点击运行。
echo prints back whatever you give it. Use it to print the word hello. · echo 会把你给它的内容原样打印出来。用它打印出 hello 这个词。