Networking Chapter 3 Homework The Most Important Differences Are Asfollowsa Emacs Not Modalb Emacs More Complex

subject Type Homework Help
subject Pages 9
subject Words 2574
subject Authors Michael Palmer

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
A Guide to Unix Using Linux, Fourth Edition 3-1
Chapter 3
Mastering Editors
At a Glance
Instructor’s Manual Table of Contents
Overview
Objectives
Teaching Tips
Quick Quizzes
page-pf2
A Guide to Unix Using Linux, Fourth Edition 3-2
Lecture Notes
Overview
Chapter 3 offers an introduction to the two most common text editors in UNIX/Linux
systems: vi and Emacs. The vi editor provides basic editing functions and is often
Chapter Objectives
Explain the basics of UNIX/Linux files, including ASCII, binary, and executable files
Teaching Tips
Understanding UNIX/Linux Files
2. Introduce the concept of machine language.
ASCII Text Files
1. Ask students if they are familiar with the term byte. Explain that the word comes from
binary term.
2. Describe the difference between text files and binary files. Stress that text files use some
3. Figure 3-1 lists the printable and nonprintable ASCII characters.
page-pf3
A Guide to Unix Using Linux, Fourth Edition 3-3
Binary Files
1. Explain why binary files are needed. Note that bitmap files are a good example of
binary files.
Executable Program Files
Using Editors
1. Introduce the following terms: editor, text editor, screen editor, and line editor.
2. Note that the two text editors normally included in UNIX/Linux are screen editors: vi
and Emacs.
The vi and Emacs editors do not offer the same functionality as GUI-based
editors such as Microsoft Word, although Emacs now offers enhanced
Quick Quiz 1
1. The exclusive use of 0s and 1s as a way to communicate with the computer is known as
____________________ language.
2. A(n) ____________________ is a string of eight binary bits.
3. ____________________ is a process of translating a program file into machine-
readable language.
4. A(n) ____________________ editor lets you work with only one line or group of lines
at a time.
page-pf4
A Guide to Unix Using Linux, Fourth Edition 3-4
Using the vi Editor
1. Describe the most important characteristics of the vi editor.
2. Explain that vi is a modal editor. Describe the three modes available in vi, and explain
how to switch between them: insert mode, command mode, and ex mode.
Creating a New File in the vi Editor
1. Use Figure 3-2 to explain how to create a new file in vi.
Inserting Text
1. Briefly describe how to use the insert (i) command.
Repeating a Change
1. Briefly describe how to use the repeat command (.). Note that this command is used in
command mode.
Moving the Cursor
1. Use Table 3-1 to explain how to move the cursor in the vi editor.
Students may ask why h, l, k , and j are used to move the cursor. Using the letter
Deleting Text
1. Use Table 3-2 to explain how to use the several deletion commands available from
page-pf5
A Guide to Unix Using Linux, Fourth Edition 3-5
Undoing a Command
1. Explain that you type u to use the undo command.
Searching for a Pattern
1. Use Table 3-3 and several examples to explain how to search for a pattern in the vi
editor.
Students may not feel comfortable with the searching capabilities in vi. Explain
that the regular expressions used in vi search are also supported in Emacs, grep,
Searching and Replacing
1. Describe the difference between screen-oriented commands and line-oriented
command.
3. Use one or more examples to explain how to search and replace text in vi.
Teaching
Tip
Note that in this chapter, all instructions for line-oriented commands include the
colon as part of the command.
Saving a File and Exiting vi
1. Use Figure 3-3 to explain how to save a file without exiting vi.
Adding Text from Another File
1. Explain how to use :r to add text from another file.
Leaving vi Temporarily
page-pf6
2. Use Figure 3-4 to explain how you can use the fg command to return to the vi session.
Changing Your Display While Editing
1. Note that to turn on line numbering in the vi editor, you use :set number. Describe the
importance of this feature.
Copying or Cutting and Pasting
1. Explain how to copy and paste and how to cut and paste in the vi editor.
Printing Text Files
1. Explain how to use the lpr shell command to print a file from vi.
Canceling an Editing Session
Getting Help in vi
1. Describe the three different ways you can get help about the use of vi:
a. Using the help command (:help).
Quick Quiz 2
1. The vi editor’s command mode is started by pressing ____________________.
2. In vi, lines containing a(n) ____________________ are not part of the file; they
indicate lines on the screen only.
page-pf7
A Guide to Unix Using Linux, Fourth Edition 3-7
3. When in command mode, you can use a(n) ____________________ to repeat the most
recent change you made.
4. Use ____________________ in command mode to delete the current line.
Using the Emacs Editor
1. Compare and contrast Emacs with the vi editor. The most important differences are as
follows:
a. Emacs is not modal.
b. Emacs is more complex than vi, but it is more consistent than vi.
c. Emacs supports a sophisticated macro language and powerful command syntax.
d. Emacs is extensible.
“Vimacs (Vim-Improved eMACS) brings Emacs's extensive key bindings and
page-pf8
A Guide to Unix Using Linux, Fourth Edition 3-8
Creating a New File in Emacs
2. If you type emacs with no file name, Emacs automatically displays several introductory
screens, beginning with the one shown in Figure 3-5 for Fedora.
Navigating in Emacs
1. Note that to navigate in the file, you can use either the cursor movement keys or the
Ctrl/Alt key combinations.
2. Explain how to save your work and how to exit from Emacs.
Deleting Information
1. Describe the different ways one can delete information in Emacs: Del, Backspace,
Ctrl+k, and Ctrl+x, u.
Copying, Cutting, and Pasting Text
1. Explain how to copy-paste or cut-paste text in Emacs.
Teaching
Tip
Remind students that in Emacs, to “yank” means to paste text from the buffer.
Searching in Emacs
Reformatting a File
Getting Help in Emacs
1. Emphasize that Emacs comes with extensive documentation and a tutorial. Explain how
to access both of these features.
page-pf9
A Guide to Unix Using Linux, Fourth Edition 3-9
Quick Quiz 3
1. A(n) ____________________ is a set of commands that automates a complex task.
2. In Emacs, ____________________ moves the cursor forward one word.
4. You use the ____________________ command to turn on the word wrap feature in
Class Discussion Topics
1. After your students have practiced using both vi and Emacs, ask them to form groups of
four or five students to discuss the pros and cons of each of these editors.
2. Do any of your students have previous experience with other text editors besides vi and
Emacs? If so, ask them to share their experiences in class.
Additional Projects
1. Ask students to practice using the Pico text editor and then write a short report
2. Ask students to research the differences between Emacs and XEmacs and write a report
summarizing their findings.
Additional Resources
1. GNU Emacs:
2. XEmacs:
3. Mastering the vi editor:
page-pfa
4. Linux text editors: Do any make the grade?
5. Using text editors:
Key Terms
and 1. UNIX/Linux store all data in the form of binary digits. Because the computer
consists of electronic circuits in either an on or off state, binary digits are perfect for
representing these states.
bitmap The rows and columns of dots or bit patterns that graphics software
transforms into an infinite variety of images.
ex mode A text-editing command mode, currently used in the vi editor, that employs
an extended set of commands initially used in an early UNIX editor called ex.
executable program file Also called an executable; a compiled file (from a
programming language) or an interpreted file (from a script) that can be run on the
computer.
page-pfb
A Guide to Unix Using Linux, Fourth Edition 3-11
machine language The exclusive use of 0s (which mean off) and 1s (which mean
on) to communicate with the computer. Years ago, programmers had to write programs
in machine language, a tedious and time-consuming process.
macro A set of commands that automates a complex task. A macro is sometimes
text editor A simplified word processor used to create and edit documents but that
has no formatting features to boldface or center text, for example.
text file A computer file composed entirely of ASCII characters.
Unicode A set of bit patterns that supports up to 65,536 characters and was
developed to offer more characters than ASCII for a broader range of languages, such
as Chinese.
Technical Notes for Hands-On Projects
Teaching
Tip
Hands-on Projects 3-1 through 3-14 are designed to be completed as a block of
step-by-step projects in which students learn how to create and edit a file using
the vi editor. These projects are performed from the command line (such as a
Hands-on projects 3-1 through 3-14 require the vi editor. Hands-on projects 3-15 through 3-20
require the Emacs editor.

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.