Certification Objective 1.01: Basic Linux Knowledg
时间:2007-03-31 来源:austin22
Certification Objective 1.01:Basic Linux Knowledge
认证目的 1.01:基本 Linux 知识
Linux and Unix are managed through a series of text files.
Linux 和 Unix 被处理过一系列的文字档。
Linux administrators do not normally use graphical editors to manage these configuration files.
Linux 系统管理师不通常使用图解式的编辑程序处理这些配置文件。
Editors such as WordPerfect, StarOffice, and yes, even Microsoft Word normally save files in a binary format that Linux can't read.
编辑程序,像是 WordPerfect , StarOffice, 和是的, 平坦的微软公司 Word 通常以 Linux 不能读的一个二进位的格式把文件存档。
Popular text editors for Linux configuration files include emacs, pico, joe, and vi.
给 Linux 配置文件的常用文字档编辑程序包括 emacs 、pico、 joe 和 vi 。
The Visual Editor
视觉的编辑程序
While emacs may be the most popular text editor in the world of Linux, every administrator needs at least a basic knowledge of vi.
emacs 可能是 Linux 的世界上最常用的文字档编辑程序,不过每个系统管理师至少需要一个 vi 的基本知识。
While emacs may be more popular and flexible, vi may help you save a broken system.
emacs 可能更常用和更有柔性,不过 vi 可能帮助你把一个坏掉的系统存档。
If you ever have to restore a critical configuration file using an emergency boot floppy, vi is probably the only editor that you'll have available.
如果你曾经必须修复使用一个紧急的启动的一个紧要关头的配置文件叭塌叭塌响的, vi 或许是可得的你将会有的唯一的编辑程序。
In reality, RHEL 3 uses an enhanced version of the vi editor, known as vim.
事实上, RHEL 3 使用的 vi 编辑程序的一个可提高版本, 他[她] 即是精力。
It adds color to different types of variables in key configuration files such as /etc/fstab.
它在主要配置中为变数的不同类型增添色彩申请如此的当做 /etc/fstab。
All regular vi commands work in the vim editor.
所有的一般 vi 指令在精力编辑程序中运作。
While you can remove the coloring in the vim editor with the :nohl command, this detail does not affect your ability to manage your Linux system.
你能在精力编辑程序中移除那个涂颜色与那 :nohl 命令,这一个明细不影响你的能力处理你的 Linux 系统。
You need to know how to restore your system from a rescue floppy, which does not have enough room to carry any editor other than vi.
你需要知道该如何修复来自援救的你的系统叭塌叭塌响的, 哪一个没有充足的房间携带除了 vi 之外的任何编辑程序。
However, the Red Hat Exam Prep guide suggests that you need to be able to 'use the rescue environment provided by the first installation CD,' which does include other console editors.
然而, 红帽考试预科的指南建议你需要能够到 '使用由第一个安装 CD 提供的援救环境,' 哪一个确实包括其他的控制台编辑程序。
If you use the joe text editor, it's available when you boot from the rescue floppy.
如果你使用 joe 文字档编辑程序,当你从援救开机的时候,它是可得的叭塌叭塌响的。
On The Job This section provides only the briefest of introductions to the vi editor.
在作业这一个区段上只提供对最简短的介绍的 vi 编辑程序。
You should know how to use the two basic modes of vi:
你应该知道该如何使用二个基本 vi 的模态:
command and insert.
命令模式和输入模式。
When you use vi to open a file, it opens in command mode.
当你使用 vi 开启一个文件的时候,它在命令模态中开启。
Some of the commands start insert mode.
一些指令开始插入模态。
Opening a file is easy:
打开一个文件很容易:
just use the vi filename command.
仅仅使用 vi 档名指令。
By default, this starts vi in command mode.
预先设定地,这让 vi 从在命令模态中开始。
An example of vi with the /etc/passwd file is shown in Figure 1-1.
一个 vi 的例子用那 /etc/passwd 文件在图 1-1 被显示。
Figure 1-1: The vi editor
图 1-1: vi 编辑程序
The following is only a brief introduction to the vi editor.
下列各项只是对 vi 编辑程序的简短介绍。
For more information, there are a number of books available, as well as an extensive manual formatted as a HOWTO available from the Linux Documentation Project at www.tldp.org.
对于较多的信息,有一些书可以用, 连同在 www.tldp.org 当做从 Linux 文件编写计画得到的 HOWTO 格式化的一本广泛的手册。
vi Command Mode
vi 命令模态
In command mode, you can do everything you need to do to a text file except edit it.
在命令模态中, 你能做你需要的每件事物对一个文字档做除了编辑它之外。
The options in command mode are broad and varied, and they are the subject of a number of book-length texts.
在命令模态的选择项是宽广又不同的,而且他们是一些书长文本的主题。
Using vi requires seven critical command skills:
使用 vi 需要七临界指令技术:
Open To open a file in the vi editor from the command line interface, run the vi filename command.
开启在来自指令行介面的 vi 编辑程序中开启一个文件,运行 vi 档名指令。
Search Start with a backslash, followed by the search term.
用被搜寻期限跟随的一个反斜线的搜寻开始。
Remember, Linux is case sensitive, so if you're searching for 'Michael' in /etc/passwd, use the /Michael (not /michael) command.
记得, Linux 是大小写有关, 因此如果你正在寻找 'Michael' 在 /etc/passwd, 使用那 /Michael (不 /michael) 指令。
Write To save your changes, use the w command.
写把你的变化存档,使用 w 指令。
You can combine commands; for example, :wq writes the file and exits vi.
你能联合指令; 举例来说, :wq 写文件和出囗 vi。
Close To leave vi, use the :q command.
关离开 vi, 使用那 :q 指令。
Abandon If you want to abandon any changes that you've made, use the :q! command.
如果你想要放弃你已经组成的任何的变化,放弃, 使用那 :q!指令。
Edit You can use a number of commands to edit files through vi, such as x, which deletes the currently highlighted character, dw, which deletes the currently highlighted word, and dd, which deletes the current line.
编辑你能使用一些指令经过像 x 这样的 vi,划除现在标明的字符, dw,划除现在标明的字组和 dd,划除目前的线编辑文件。
Remember, p places text from a buffer, and U restores text from a previous change.
记得, p 放置来自一个缓冲区的文本,而且 U 修复来自一个早先的变化的文本。
Insert A number of commands allow you to start insert mode, including i to start inserting text at the current position of the editor, and o to open up a new line immediately below the current position of the cursor.
插入一些指令让你启动插入物模态, 包括 i 启动在编辑程序的目前位置插入文本, 和 o 在光标的目前位置下面立刻打开一个新的线。
Basic Text Editing
基本文本编辑的
In modern Linux systems, editing files with vi is easy.
在现代的 Linux 系统,编辑文件用 vi 很容易。
Just use the normal navigation keys (arrow keys, PAGE UP, and PAGE DOWN), and then one of the basic commands such as i or o to start vi's insert mode, and type your changes directly into the file.
仅仅使用正常的航行术键 (箭头键, PAGE UP,和PAGE DOWN), 然后一那基本的指令如此的当做 i 或者 o 启动 vi 的插入物模态, 而且进入文件之内直接地键入你的变化。
When you're finished with insert mode, press the ESC key to return to command mode.
当你被用完插入物模态的时候,按 ESC 键回到命令模态。
You can then save your changes, or abandon them and exit vi.
然后你能把你的变化存档, 或放弃他们而且退出 vi 。
Exercise 1-1:Using vi to Create a New User
练习 1-1:使用 vi 产生一个新的使用者
In this exercise, you'll create a new user by editing the /etc/passwd file with the vi text editor.
在这练习, 你将会藉由编辑产生一个新使用者那 /etc/passwd 用 vi 文字档编辑程序的文件。
While there are other ways to create new Linux users, this exercise helps you verify your skills with vi and at the command line interface.
有其他的方法要产生新的 Linux 使用者,不过这练习用 vi 和在指令行介面帮助你确认你的技术。
Open a Linux command line interface.
开启一个 Linux 指令行介面。
Log in as the root user, and type the vi /etc/passwd command.
登录如根使用者, 和型态 vi/etc/passwd 命令。
Navigate to the last line in the file.
对在文件中的最后一个行航行。
As you should already know, there are several ways to do this in command mode, including the DOWN ARROW key, the PAGE DOWN key, the G command, or even the K key.
当你应该已经知道,有一些方法要在命令模态中做这, 包括向下的箭头键, PAGE DOWN键, G 指令, 或甚至, K 键。
Make one copy of this line.
作这一个线的一个拷贝。
If you're already comfortable with vi, you should know that you can copy an entire line to the buffer with the yy command.
如果你对 vi 感到已经舒服,你应该知道你能用 yy 指令拷贝对缓冲区的一个整个的线。
This 'yanks' the line into buffer.
这 '强拉' 进入缓冲区之内的线。
You can then restore, or put that line as many times as desired with the p command.
然后你能修复, 或放那一个线当做许多次当做以 p 指令需要。
Change the username, user ID, group ID, user comment, and home directory for the new user.
改变使用者名称, 使用者身份证、组身份证, 使用者注解, 和家庭的新使用者的目录。
If you understand the basics of Linux or Unix, you'll understand their locations on each line in the /etc/passwd file.
如果你了解 Linux 的基本或者 Unix ,你将会在那 /etc/passwd 文件的每个线上了解他们的位置。
For example, in Figure 1-2, this corresponds to tb, 501, 501, Tony Blair, and /home/tb.
举例来说,在图 1-2 ,这符合 tb, 501,501, 汤尼.布莱尔, 和 /家/tb。
Make sure the username also corresponds to the home directory.
确定使用者名称也符合家目录。
Figure 1-2:Adding a new user in /etc/passwd
图 1-2:把一个新的使用者加入 /etc/passwd
Return to command mode by pressing the ESC key.
藉由按 ESC 键回到命令模态。
Save the file with the wq command.
用 wq 指令把文件存档。
As the root user, run the passwd newuser command.
身为根使用者,运行 passwd newuser 指令。
Assign the password of your choice to the new user.
分配你的选择的口令[字] 给新的使用者。
认证目的 1.01:基本 Linux 知识
Linux and Unix are managed through a series of text files.
Linux 和 Unix 被处理过一系列的文字档。
Linux administrators do not normally use graphical editors to manage these configuration files.
Linux 系统管理师不通常使用图解式的编辑程序处理这些配置文件。
Editors such as WordPerfect, StarOffice, and yes, even Microsoft Word normally save files in a binary format that Linux can't read.
编辑程序,像是 WordPerfect , StarOffice, 和是的, 平坦的微软公司 Word 通常以 Linux 不能读的一个二进位的格式把文件存档。
Popular text editors for Linux configuration files include emacs, pico, joe, and vi.
给 Linux 配置文件的常用文字档编辑程序包括 emacs 、pico、 joe 和 vi 。
The Visual Editor
视觉的编辑程序
While emacs may be the most popular text editor in the world of Linux, every administrator needs at least a basic knowledge of vi.
emacs 可能是 Linux 的世界上最常用的文字档编辑程序,不过每个系统管理师至少需要一个 vi 的基本知识。
While emacs may be more popular and flexible, vi may help you save a broken system.
emacs 可能更常用和更有柔性,不过 vi 可能帮助你把一个坏掉的系统存档。
If you ever have to restore a critical configuration file using an emergency boot floppy, vi is probably the only editor that you'll have available.
如果你曾经必须修复使用一个紧急的启动的一个紧要关头的配置文件叭塌叭塌响的, vi 或许是可得的你将会有的唯一的编辑程序。
In reality, RHEL 3 uses an enhanced version of the vi editor, known as vim.
事实上, RHEL 3 使用的 vi 编辑程序的一个可提高版本, 他[她] 即是精力。
It adds color to different types of variables in key configuration files such as /etc/fstab.
它在主要配置中为变数的不同类型增添色彩申请如此的当做 /etc/fstab。
All regular vi commands work in the vim editor.
所有的一般 vi 指令在精力编辑程序中运作。
While you can remove the coloring in the vim editor with the :nohl command, this detail does not affect your ability to manage your Linux system.
你能在精力编辑程序中移除那个涂颜色与那 :nohl 命令,这一个明细不影响你的能力处理你的 Linux 系统。
You need to know how to restore your system from a rescue floppy, which does not have enough room to carry any editor other than vi.
你需要知道该如何修复来自援救的你的系统叭塌叭塌响的, 哪一个没有充足的房间携带除了 vi 之外的任何编辑程序。
However, the Red Hat Exam Prep guide suggests that you need to be able to 'use the rescue environment provided by the first installation CD,' which does include other console editors.
然而, 红帽考试预科的指南建议你需要能够到 '使用由第一个安装 CD 提供的援救环境,' 哪一个确实包括其他的控制台编辑程序。
If you use the joe text editor, it's available when you boot from the rescue floppy.
如果你使用 joe 文字档编辑程序,当你从援救开机的时候,它是可得的叭塌叭塌响的。
On The Job This section provides only the briefest of introductions to the vi editor.
在作业这一个区段上只提供对最简短的介绍的 vi 编辑程序。
You should know how to use the two basic modes of vi:
你应该知道该如何使用二个基本 vi 的模态:
command and insert.
命令模式和输入模式。
When you use vi to open a file, it opens in command mode.
当你使用 vi 开启一个文件的时候,它在命令模态中开启。
Some of the commands start insert mode.
一些指令开始插入模态。
Opening a file is easy:
打开一个文件很容易:
just use the vi filename command.
仅仅使用 vi 档名指令。
By default, this starts vi in command mode.
预先设定地,这让 vi 从在命令模态中开始。
An example of vi with the /etc/passwd file is shown in Figure 1-1.
一个 vi 的例子用那 /etc/passwd 文件在图 1-1 被显示。
Figure 1-1: The vi editor
图 1-1: vi 编辑程序
The following is only a brief introduction to the vi editor.
下列各项只是对 vi 编辑程序的简短介绍。
For more information, there are a number of books available, as well as an extensive manual formatted as a HOWTO available from the Linux Documentation Project at www.tldp.org.
对于较多的信息,有一些书可以用, 连同在 www.tldp.org 当做从 Linux 文件编写计画得到的 HOWTO 格式化的一本广泛的手册。
vi Command Mode
vi 命令模态
In command mode, you can do everything you need to do to a text file except edit it.
在命令模态中, 你能做你需要的每件事物对一个文字档做除了编辑它之外。
The options in command mode are broad and varied, and they are the subject of a number of book-length texts.
在命令模态的选择项是宽广又不同的,而且他们是一些书长文本的主题。
Using vi requires seven critical command skills:
使用 vi 需要七临界指令技术:
Open To open a file in the vi editor from the command line interface, run the vi filename command.
开启在来自指令行介面的 vi 编辑程序中开启一个文件,运行 vi 档名指令。
Search Start with a backslash, followed by the search term.
用被搜寻期限跟随的一个反斜线的搜寻开始。
Remember, Linux is case sensitive, so if you're searching for 'Michael' in /etc/passwd, use the /Michael (not /michael) command.
记得, Linux 是大小写有关, 因此如果你正在寻找 'Michael' 在 /etc/passwd, 使用那 /Michael (不 /michael) 指令。
Write To save your changes, use the w command.
写把你的变化存档,使用 w 指令。
You can combine commands; for example, :wq writes the file and exits vi.
你能联合指令; 举例来说, :wq 写文件和出囗 vi。
Close To leave vi, use the :q command.
关离开 vi, 使用那 :q 指令。
Abandon If you want to abandon any changes that you've made, use the :q! command.
如果你想要放弃你已经组成的任何的变化,放弃, 使用那 :q!指令。
Edit You can use a number of commands to edit files through vi, such as x, which deletes the currently highlighted character, dw, which deletes the currently highlighted word, and dd, which deletes the current line.
编辑你能使用一些指令经过像 x 这样的 vi,划除现在标明的字符, dw,划除现在标明的字组和 dd,划除目前的线编辑文件。
Remember, p places text from a buffer, and U restores text from a previous change.
记得, p 放置来自一个缓冲区的文本,而且 U 修复来自一个早先的变化的文本。
Insert A number of commands allow you to start insert mode, including i to start inserting text at the current position of the editor, and o to open up a new line immediately below the current position of the cursor.
插入一些指令让你启动插入物模态, 包括 i 启动在编辑程序的目前位置插入文本, 和 o 在光标的目前位置下面立刻打开一个新的线。
Basic Text Editing
基本文本编辑的
In modern Linux systems, editing files with vi is easy.
在现代的 Linux 系统,编辑文件用 vi 很容易。
Just use the normal navigation keys (arrow keys, PAGE UP, and PAGE DOWN), and then one of the basic commands such as i or o to start vi's insert mode, and type your changes directly into the file.
仅仅使用正常的航行术键 (箭头键, PAGE UP,和PAGE DOWN), 然后一那基本的指令如此的当做 i 或者 o 启动 vi 的插入物模态, 而且进入文件之内直接地键入你的变化。
When you're finished with insert mode, press the ESC key to return to command mode.
当你被用完插入物模态的时候,按 ESC 键回到命令模态。
You can then save your changes, or abandon them and exit vi.
然后你能把你的变化存档, 或放弃他们而且退出 vi 。
Exercise 1-1:Using vi to Create a New User
练习 1-1:使用 vi 产生一个新的使用者
In this exercise, you'll create a new user by editing the /etc/passwd file with the vi text editor.
在这练习, 你将会藉由编辑产生一个新使用者那 /etc/passwd 用 vi 文字档编辑程序的文件。
While there are other ways to create new Linux users, this exercise helps you verify your skills with vi and at the command line interface.
有其他的方法要产生新的 Linux 使用者,不过这练习用 vi 和在指令行介面帮助你确认你的技术。
Open a Linux command line interface.
开启一个 Linux 指令行介面。
Log in as the root user, and type the vi /etc/passwd command.
登录如根使用者, 和型态 vi/etc/passwd 命令。
Navigate to the last line in the file.
对在文件中的最后一个行航行。
As you should already know, there are several ways to do this in command mode, including the DOWN ARROW key, the PAGE DOWN key, the G command, or even the K key.
当你应该已经知道,有一些方法要在命令模态中做这, 包括向下的箭头键, PAGE DOWN键, G 指令, 或甚至, K 键。
Make one copy of this line.
作这一个线的一个拷贝。
If you're already comfortable with vi, you should know that you can copy an entire line to the buffer with the yy command.
如果你对 vi 感到已经舒服,你应该知道你能用 yy 指令拷贝对缓冲区的一个整个的线。
This 'yanks' the line into buffer.
这 '强拉' 进入缓冲区之内的线。
You can then restore, or put that line as many times as desired with the p command.
然后你能修复, 或放那一个线当做许多次当做以 p 指令需要。
Change the username, user ID, group ID, user comment, and home directory for the new user.
改变使用者名称, 使用者身份证、组身份证, 使用者注解, 和家庭的新使用者的目录。
If you understand the basics of Linux or Unix, you'll understand their locations on each line in the /etc/passwd file.
如果你了解 Linux 的基本或者 Unix ,你将会在那 /etc/passwd 文件的每个线上了解他们的位置。
For example, in Figure 1-2, this corresponds to tb, 501, 501, Tony Blair, and /home/tb.
举例来说,在图 1-2 ,这符合 tb, 501,501, 汤尼.布莱尔, 和 /家/tb。
Make sure the username also corresponds to the home directory.
确定使用者名称也符合家目录。
Figure 1-2:Adding a new user in /etc/passwd
图 1-2:把一个新的使用者加入 /etc/passwd
Return to command mode by pressing the ESC key.
藉由按 ESC 键回到命令模态。
Save the file with the wq command.
用 wq 指令把文件存档。
As the root user, run the passwd newuser command.
身为根使用者,运行 passwd newuser 指令。
Assign the password of your choice to the new user.
分配你的选择的口令[字] 给新的使用者。
相关阅读 更多 +
排行榜 更多 +