Networking Chapter 3 Homework Red Hat Enterprise Linux The Cursormoves The Beginning The Word Consists Line

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

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
1
Guide to UNIX Using Linux Fourth Edition
Chapter 3 Solutions
Answers to the Chapter 3 Review Questions
1. You are using vi to edit a file and have just entered 12 new lines. You need to replicate the same 12
lines right after you enter them. What command-mode command can you type to replicate the lines?
(Choose all that apply.)
2. Which of the following enables you to move the cursor to the left while you are in command mode in
the vi editor? (Choose all that apply.)
3. When you started the vi editor, you forgot to specify the name for the new file you are creating. To
save steps next time, how can you specify the name of a new file when you first start vi?
4. Your colleague has written a line of text in vi and now wants to delete the line, but save its contents in
a buffer in case he decides to bring back the line he deletes. What do you recommend?
dd.
5. You are in the vi editor and its now noon. Everyday at noon you run a program called update, which
updates a database. How can you run the program without closing your vi session?
6. While you are working on a report in vi, you decide to insert information from another text file in your
home directory called summary_data. Which of the following commands (from command mode)
enables you to add the contents of summary_data?
7. You’re editing a document using vi and you are near the end of a page. You want to quickly go back to
the top of the page to check something you said. Which of the following command-line commands
enables you to quickly go to the top of the page?
8. You are preparing to give a training session on the vi editor. How would you describe it? (Choose all
that apply.)
9. While working in the Emacs editor, you delete a section of text and then decide to undo your deletion.
Which of the following commands should you use?
10. When you copy text in Emacs, you must mark the text you want to copy by using which of the
following commands?
11. You’ve used Emacs to write advertising copy about a new software product your company has
developed. Now you find out that the name of the product has been slightly. What command can you
use to track down all references to the old name so you can locate them?
page-pf2
2
12. How can you find out information about the status of an editing session while in the vi editor? (Choose
all that apply.)
13. You are using the vi editor to create a list of tasks on each line and you would like an easy way to
number each line (task) listed in the file. Which of the following is an easy solution?
14. You have been working on a long vi text file and now you’ve got to rush off to a meeting. How can
you quickly save your work and exit the vi editor? (Choose all that apply.)
15. While editing a file in vi you realize that you have been spelling the word receive as recieve. How can
you find all occurrences of your misspelled receive? (Choose all that apply.))
16. As you look over the shoulder of an employee who is using the vi editor, you see her use the command
:l $s/capitol/capital. What does this command do?
17. You have just pressed Ctrl+x,Ctrl+s in the Emacs editor thinking that this will exit Emacs, but it
seems like nothing has happened. What is the problem?
18. You’ve just finished entering a one-page memo in Emacs and now want to quickly go to the beginning
so you can reread it. What command enables you to quickly go to the beginning?
19. Which of the following are menus that you would find on the menu bar in Emacs? (Choose all that
apply.)
20. Which of the following commands enables you to use online help in Emacs?
21. How can you get help for using the vi editor? (Choose all that apply.)
22. What is the name of a standardized bit pattern for characters and numbers that is used by most
computer operating systems?
23. What is the process called compiling?
24. How can you print a file while you are in the vi editor?
25. You have started Emacs without specifying a file name for the existing file you want to open. Is there a
way to specify the file name and open the file after you've started Emacs, and if so how?
page-pf3
3
Hands-On Projects Tips and Solutions for Chapter 3
Project 3-1
Students begin a series of projects to create and edit a file using the vi editor. In this project, they open
Project 3-2
This project enables students to use the insert mode in the vi editor, in which they practice typing
Project 3-3
In this project, students use the repeat command to repeat the text they have previously entered.
Project 3-4
.
For this project, students practice moving around in a file via the command mode cursor-movement
options.
Project 3-5
For this project, students practice moving around in a file and using several delete commands. They
also insert new text.
Project 3-6
In this project, students practice string searches while in the command mode.
In Step 3, students should find in Fedora the “con” in “consists” in line 1 and “consist” in line 5 are
Project 3-7
Students use screen-oriented and line-oriented editing commands for this project.
In Step 4 of the first set of steps, there are two occurrences of “text and one occurrence of “Text.”
page-pf4
4
Project 3-8
This project enables students to practice saving their work without exiting and then practice saving
their work and exiting the vi editor.
Project 3-9
In this project, students copy the contents of the textfiles file into a new file called practice.
In Step 3, students should observe that the status line shows the name of the file they copied in, plus
the number of lines and characters.
Project 3-10
Students learn two ways to shell out of vi to run commands: :! and Ctrl+z.
Project 3-11
This project has the students turn on line numbering to illustrate how to facilitate tasks, such as
deleting a group of lines.
Project 3-12
In this project, students practice cutting lines and then pasting them at the end of a document.
Project 3-13
Often it is a good idea to print a document before exiting. This project shows students how to print a
document while they are still in their vi edit session. Their computers will need to be configured for a
default printer.
Project 3-14
Project 3-15
This project is the first in a series of projects in which students practice with the Emacs editor. In this
project, they create a new file called practice.fil, save their work, and exit Emacs.
page-pf5
In Step 3, students should note that the file is written to disk.
Project 3-16
In this project, students practice using the arrow keys and other key combinations to navigate in a file.
Project 3-17
Project 3-19
Students use the search facilities of Emacs in this project.
In Step 3, of the first set of steps, “on” occurs three times in the word “contain.”
Project 3-20
Discovery Exercises
1. Using the vi editor:
Create a document with four lines each containing the word “today.”
Copy the first four lines using only one command.
Save the file and exit vi.
Reopen the document and change “today” to “yesterday” only on the first four lines.
2. Using the vi editor:
Create a document called first.file, and enter a few lines of text in it. Save it.
Create a second document called second.file, and enter a few lines of text in it. Save it.
Create a third document called third.file by merging the text from the first two files.
Save the third file, and exit the editor.
Type vi third.file and press Enter to be certain third.file contains the text from both files.
page-pf6
6
3. Delete all text from third.file that you created using vi and then restore it.
4. Using the Emacs editor, create a new file, called sonnet, that contains the first four lines of
Shakespeare’s 80th Sonnet:
O, how I faint when I of you do write,
Knowing a better spirit doth use your name,
And in the praise thereof spends all his might,
To make me tongue-tied, speaking of your fame!
5. Move the cursor to any letter in the word “better” (except “b”) on the second line.
6. Use the command that causes the current word to be transposed with the one that follows it. After
executing the command, the line should read:
Knowing a spirit better doth use your name,
7. Move the cursor to the word “doth” on the same line.
8. Use the command to delete the current word.
9. Move the cursor to the first character of the word “spirit” on the same line.
10. Use the command that capitalizes the letters of the word.
11. Move the cursor under the letter “y” in the word “your” on the same line.
12. Use the command that deletes the character above the cursor. The line should now read:
Knowing a SPIRIT better use our name,
13. Move the cursor to the word “spends” on the third line.
page-pf7
14. Use the command that deletes text to the end of the line. The line should now read:
And in the praise thereof
Answer: Make sure the cursor is under the “s” and press Ctrl+k.
15. Move the cursor to the beginning of the first line.
16. Use the command that puts a mark at the cursor location.
17. Move the cursor to the end of the first line. Use the command that marks the particular cursor
location.
18. Move the cursor to the first character of the first line.
19. Use the command that deletes marked text that is, deletes the first line.
20. Move the cursor to the end of the file. Use the command that restores deleted text. The text that
was the first line of the file is now at the end of the file. Save your work and then close the Emacs
editor.
21. Create a file with 12 lines of text. Delete the second word in the text.
22. Go to the fifth line and insert your first and last name.
23. Remove the eighth line, and place it at the end of the file.
page-pf8
8
24. Use the command to go to the first line of the file.
25. Search for your last name.
26. Save the file but do not exit vi.
27. Without exiting vi, temporarily execute the ls command to confirm that the file is saved.
Answer: Type Ctrl+z to access the command prompt. Type ls and press Enter. Type fg and
28. Enter the command that causes line numbers to appear.
29. Delete lines 9 and 10.
30. Move to the line of text that contains your first and last name, cut it, and place the text in the
buffer.
31. Paste the line with your first and last name in the middle of the text.
32. Using the practice file, practice copying and pasting the text to rearrange the order of the lines.
Answer: Copy lines of text and paste in random locations.
33. Add text to the file, and practice using the cursor movement commands.
34. Replace all occurrences of the word “form” with “create.”
Answer: Press Alt+< to move to the beginning of the file. Click the Edit menu, point to
35. Select five words and convert them to all uppercase.
36. Delete a line and the undo the deletion
page-pf9
9
37. Transpose the first two words in each line.
38. Save the file and exit Emacs.
Answer: Press Ctrl+x, Ctrl+s to save and then Ctrl+x, Ctrl+c to exit.

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.