原版英文书籍《Linux命令行》阅读记录1-什么是shell?

Author Avatar
cuteximi 10月 13, 2018
  • 在其它设备中阅读本文章

背景:
阅读英文原作只为了更好地理解书中的精髓,当然也是为了更好地掌握书中的技巧。我们会坚持阅读全书,并记录书中的精髓。

1. 理解 Linux 的 “自由”

Many people speak of “freedom” with regard to Linux. Freedom is the power to decide what your computer does and the only way to have this freedom is to know what your computer is doing. Freedom is a computer that is without any secrets, one where everything can be known if you care enough to find it.

很多人一说到Linux, 就会说自由。但是你真的而理解这种自由吗?这种自由是一种权力,能够决定你的计算机干什么,获取这种自由的唯一方式就是知道你的计算机在做什么。自由就是你的计算机没有任何㊙️,你可以从计算机那里了解一切,只要你用心去寻找。

2. 什么是 shell

We speak of the command line, we are really referring to the shell. The shell is a program that takes keyboard commands and passes them to the operating system to carry out.

一说起命令行,我们真正指的是 shell。shell 就是一个程序,把键盘的输入传递给操作系统去执行。

3. 初次相遇 shell

第一次见到 shell,你只会看到一行提示符,形如:[me@linuxbox ~]$

This is called a shell prompt and it will appear whenever the shell is ready to accept input.

这叫做 shell 提示符, 无论何时当 shell 准备好接受输入时,就会闲这样的提示符。当然,出现的形式会根据不同的 Linux 发行版有所不同。但是大体上会包含 主机名 用户名 当前目录 和一个美元符号

🤔另外,如果提示符最后是 # 号,而不是 $,会表示这是一个具有 super root 权限的终端。

3. 一些简单入门的小命令

命令历史:使用 ⬆️ 箭头可以浏览以往的命令,以往的命令会重新出现在提示符后面。
移动光标:使用 ⬅️ ➡️ 箭头可以移动光标,来更好地编辑命令。
时间:date 显示系统当前时间和日期

[me@linuxbox ~]$ date
Sun Sep 30 10:02:00 CST 2018

日历:cal 与上一个命令相关,默认显示当前月份的日历。

[me@linuxbox ~]$ cal
   September 2018
Su Mo Tu We Th Fr Sa
                   1
 2  3  4  5  6  7  8
 9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30

查看磁盘剩余空间:df

[me@linuxbox ~]$ df
Filesystem    512-blocks      Used Available Capacity iused               ifree %iused  Mounted on
/dev/disk1s1   489620264 166659552 315340480    35%  945005 9223372036853830802    0%   /
devfs                385       385         0   100%     666                   0  100%   /dev
/dev/disk1s4   489620264   6291496 315340480     2%       3 9223372036854775804    0%   /private/var/vm
map -hosts             0         0         0   100%       0                   0  100%   /net
map auto_home          0         0         0   100%       0                   0  100%   /home
/dev/disk2s1     5859376    378616   5480760     7%    2830          4294964449    0%   /Volumes/ACDSee
/dev/disk3s2      310480    283440     27040    92%     255          4294967024    0%   /Volumes/Charles Proxy v4.2.7
ximi:~ taoshilei$

结束终端会话:exit

Note: Don’t be tempted to use Ctrl-c and Ctrl-v to perform copy and paste inside a terminal window. They don’t work.

提示:不要在终端窗口使用 Ctrl-c 和Ctrl-v 来完成复制和粘贴工作。这些不起作用。这两个命令有别的含义,他们早于在微软之前就已经定义了这两个命令的含义,所以不是我们在windows下熟悉的复制粘贴。

This blog is under a CC BY-NC-SA 3.0 Unported License
本文链接:http://blog.cuteximi.com/原版英文书籍《Linux命令行》阅读记录1-什么是shell/