UNIX/Linux 系统管理技术手册阅读(三)

简介:

2016.8.12 23:20-23:50

1.2 SUGGESTED BACKGROUND

1.2 读者的知识背景

  We assume in this book that you have a certain amount of Linux or UNIX experience. In particular, you should have a general concept of how the system looks and feels from the user’s perspective since we don’t review this material. Several good books can get you up to speed; see the reading list on page 27.

  本书假定读者已经具备一定程序的Linux或者UNIX经验。尤其要从用户的角度对系统的风格有个一般性的概念,因为我们不再复核这方面的材料。有一些优秀的书籍可以帮助读者迅速掌握这些概念,请看第27页。

  Even in these days of Compiz-powered 3D desktops, the GUI tools for system administration on UNIX and Linux systems remain fairly simplified in comparison with the richness of the underlying software. In the real world, we still administer by editing configuration files and writing scripts, so you’ll need to be comfortable with both a command-line shell and a text editor.

  即便在现今有三维图形显示功能的桌面计算机上,用于UNIX和Linux系统管理的GUI工具与其下层丰富的软件相比,依然显得相当简单。在现实世界里,我们仍然要通过编辑配置文件和编写脚本来完成管理工作,因此读者需要习惯于使用某种命令行的shell和某种文本编辑器。

  Your editor can be a GUI tool like gedit or a command-line tool such as vi or emacs. Word processors such as Microsoft Word and OpenOffice Writer are quite different from text editors and are nearly useless for administrative tasks. Command-line tools have an edge because they can run over simple SSH connections and on ailing systems that won’t boot; there’s no need for a window system. They are also much faster for the quick little edits that administrators often make.

  编辑器可以像gedit那样的GUI工具,也可以是像vi或emacs那样的命令行工具。像Microsoft Word和OpenOffice这样的字处理程序和广本编辑器差别很大,对于系统管理工作几乎没有什么用处。命令行工具有个优势,因为它们可以通过一条SSH连接运行,还可以在出问题不能启动的系统上使用;而且不需要用图形窗口系统。对于系统管理员常做的微小编辑工作来说,它们的运行速度也快很多。

  We recommend learning vi (now seen most commonly in its rewritten form, vim), which is standard on all UNIX and Linux systems. Although it may appear a bit pallid when compared with glitzier offerings such as emacs, it is powerful and complete. GNU’s nano is a simple and low-impact “starter editor” that has on-screen prompts. Be wary of nonstandard editors, though; if you become addicted to one, you may soon tire of dragging it along with you to install on every new system.

  我们推荐读者学会使用vi(现在最常见的是它的一种经过重写的形式,即vim)它是所有UNIX和Linux系统上的标准软件。尽管同emasc这样的华丽软件相比,vi可能显得有些平淡,但vi的功能还是非常强大和完善的。GNU的nano是一种简单、易上手的“入门编辑器”,它有屏幕提示功能。选用非标准的编辑器则要小心,如果读者已经对这样的一种编辑器“上了瘾”,那么很快就会对它感到厌烦,因为需要把它带到身边,以便在每个新系统上都要安装一次。


2016.8.13 23:00-23:40

  One of the mainstays of administration (and a theme that runs throughout this book) is the use of scripts to automate administrative tasks. To be an effective administrator, you must be able to read and modify Perl and bash/sh scripts.

  系统管理工作的主要支柱之一(并且也是贯穿本书的一个主题),是使用脚本来自动完成管理任务。更成为一名高效率的系统管理员,必须能够阅读并修改Perl和bash/sh脚本。

  For new scripting projects, we recommend Perl or Python. As a programming language, Perl is admittedly a bit strange. However, it does include many features that are indispensable for administrators. The O’Reilly book Programming Perl by Larry Wall et al. is the standard text; it’s also a model of good technical writing. A full citation is given on page 27.

  对于编写新脚本,我们推荐使用Perl或者Python。作为一种编程语言,Perl有些奇怪,不过它确实包含了许多对管理员来说不可少的特性。由O'Reilly出版、Larry Wall等编写的Programming Perl一书是Perl的标准教程,该书是技术图书的典范,本书27页给出了更完整的信息。

  Many administrators prefer Python to Perl, and we know of sites that are making a concerted effort to convert. Python is a more elegant language, and Python scripts are generally more readable and easier to maintain. (As Amazon’s Steve Yegge said, “The Python community has long been the refuge for folks who finally took the red pill and woke up from the Perl Matrix.”) A useful set of links that compare Python to other scripting languages (including Perl) can be found at python.org/doc/Comparisons.html.

  许多系统管理员更愿意用Python而不是Perl,而且我们也知道有些地方正在一起努力从Perl转向Python。Python是一种比Perl更优美的语言,而且Python脚本往往可读性更好,也更容易维护(正如亚马逊公司的Steve Yegge所说,“长久以来,Python社区都是从Perl阵营逃出来的人的庇护所,这些人吞下红色的药丸,从Perl的Matrix里苏醒过来”)。从python.org/doc/Comparisons.html可以找到一组有用的链接,把Ptyhon同其他脚本语言(包含Perl)进行一番比较。

  Ruby is an up-and-coming language that maintains many of the strengths of Perl while avoiding some of Perl’s syntactic pitfalls and adding modern object-oriented features. It doesn’t yet have a strong tradition as a scripting language for system administrators, but that will likely change over the next few years.

  Ruby是一款正处于上升期的语言,它保留了Perl的许多强大功能,又避免了Peral的一些语法缺陷,还增加了现代的面向对象特性。它作为系统管理员的一款脚本语言,其根基还不深,但在未来几年内,这种情况可能会有所改变。

  We also suggest that you learn expect, which is not a programming language so much as a front end for driving interactive programs. It’s an efficient glue technology that can replace some complex scripting. expect is easy to learn.

   我们还推荐读者学会expect。它与其说是一款编程语言,倒不如说是用于驱动交互式程序执行的前端语言。它是一款高效的“胶水”语言,能够替代一些复杂的脚本编程,expect脚本学起来很容易。

  Chapter 2, Scripting and the Shell, summarizes the most important things to know about scripting for bash, Perl, and Python. It also reviews regular expressions (text matching patterns) and some shell idioms that are useful for sysadmins.

  本书的第2章总结了有关bash、Perl和Python脚本编程最重要的知识。这一章还复习了正则表达式(文本匹配模式)和一些shell的惯用法,它们对用系统管理工作来说很有用。





      本文转自cix123  51CTO博客,原文链接:http://blog.51cto.com/zhaodongwei/1837474,如需转载请自行联系原作者




相关文章
|
27天前
|
Linux 数据安全/隐私保护 虚拟化
Linux技术基础(1)——操作系统的安装
本文是龙蜥操作系统(Anolis OS) 8.4 的安装指南,用户可以从[龙蜥社区下载页面](https://openanolis.cn/download)获取ISO镜像。安装方法包括物理机的光驱和USB闪存方式,以及虚拟机中的VMware Workstation Pro设置。安装过程涉及选择语言、配置安装目标、选择软件集合和内核,设置Root密码及创建新用户。安装完成后,可通过文本模式或图形化界面验证系统版本,如Anolis OS 8.4,标志着安装成功。
|
28天前
|
安全 Shell Linux
【Shell 命令集合 系统管理 】Linux 锁定终端 vlock命令 使用指南
【Shell 命令集合 系统管理 】Linux 锁定终端 vlock命令 使用指南
35 1
|
28天前
|
监控 Shell Linux
【Shell 命令集合 系统管理 】Linux 显示当前登录到系统的用户信息 who命令 使用指南
【Shell 命令集合 系统管理 】Linux 显示当前登录到系统的用户信息 who命令 使用指南
43 1
|
28天前
|
监控 Shell Linux
【Shell 命令集合 系统管理 】Linux 显示目前登入系统的用户信息 w命令 使用指南
【Shell 命令集合 系统管理 】Linux 显示目前登入系统的用户信息 w命令 使用指南
44 2
|
28天前
|
存储 Shell Linux
【Shell 命令集合 系统管理 】Linux 修改用户的属性和配置 usermod命令 使用指南
【Shell 命令集合 系统管理 】Linux 修改用户的属性和配置 usermod命令 使用指南
30 1
|
28天前
|
搜索推荐 Shell Linux
【Shell 命令集合 系统管理 】Linux 管理用户配置文件 userconf命令 使用指南
【Shell 命令集合 系统管理 】Linux 管理用户配置文件 userconf命令 使用指南
32 2
|
10天前
|
安全 Unix Linux
一、linux 常用命令之 linux版本信息 系统管理与设置 持续更新******
一、linux 常用命令之 linux版本信息 系统管理与设置 持续更新******
14 0
|
25天前
|
弹性计算 Linux Shell
Linux技术基础(2)——文本处理
文本处理实验:探索[Vim](https://developer.aliyun.com/adc/scenario/aced2264751f4866a8340de4cf9db0fa)的命令、输入和底线模式,学习文本编辑快捷操作,如光标移动、删除、复制和粘贴。了解如何使用底线命令模式进行文件保存、退出及搜索替换。同时,掌握`cat`、`more`、`less`、`head`、`tail`等文本查看命令,以及`stat`、`wc`、`file`、`diff`等文件处理命令。利用`grep`、`sed`、`awk`和`cut`进行文本搜索、替换和分析。
|
28天前
|
网络协议 Shell Linux
【Shell 命令集合 系统管理 】Linux 查询域名的注册信息 whois命令 使用指南
【Shell 命令集合 系统管理 】Linux 查询域名的注册信息 whois命令 使用指南
46 1
|
28天前
|
存储 Shell Linux
【Shell 命令集合 系统管理 】Linux 显示当前登录用户的用户 whoami命令 使用指南
【Shell 命令集合 系统管理 】Linux 显示当前登录用户的用户 whoami命令 使用指南
43 1