Unix chapter 3 point quiz
In command mode in the vi editor, which of the following symbols moves the cursor to the end of the current line?
$
Identify the repeat command to replicate the most recent changes you made to text in the vi editor.
.
You have just entered four lines of text in the vi editor. Use the repeat command to copy the four lines of text to the current location.
.
search for the text Linux in the vi editor.
/Linux
What binary digits represents the state of "off"?
0
You are working on a file that is a program and you have a printout of the file in front of you. From the printout, you realize that you need to correct a programming error on line 242. What command can you use to go directly to this line in the vi editor? 1) 242G 2) 242 3) Ctrl+l, 242 4) none of these choices 5) /242
1
You have been editing a file in vi and decide to undo the most recent two actions you have entered. What should you type? 1) Press Esc, u, u 2) click the undo icon 3) press shift+ctrl+b twic 4) none of these choices 5) press :b, :b
1
To leave vi temporarily to find the current date and time, you would perform which of the following operations in command mode? 1) :!date 2) !:date 3) !date 4) :date 5) none of these choices
1) :!date
You are a newcomer to using vi and want to review its documentation before you edit a file. Which of the following are options in this sistuation? choose all that apply 1) open vi, press the insert key, and press ctrl+alt+h 2) open vi, press esc, type :!man vi, and press enter 3) open the vi editor with no file as the argument, because the documentation appears automatically 4) type man vi at the command line before you open vi
2,4
Identify the "go to" command to go to the beginning of the second line in the vi editor.
2G
Assume that you are in command mode. Provide the following vi editor command sequence: Blank # 1) move to the beginning of the second line of text, Blank#2) delete from the cursor to the end of the line, and Blank#3) paste the contents of the clipboard
2G, d$, p
In vi, you postion the cursor on line 18 and then type 5dd. Next, you move the cursor to the end of the file and press p. What does this do? 1) it turns on line numbering for lines 18 through 22 and then moves the cursor to the beginning of the file. 2) none of these choices 3) it cuts line 18 through 22 and then pastes the contents of those lines at the end of the file 4) it moves the cursor to line 5 and then purges the line 5) it turns on line numbering for lines 18 through 22 and then moves the cursor to middle of the file
3
If you use the Ctrl+z option to access the command line of your shell from vi, which of the following shell commands returns you to your edit session? 1) gf 2) none 3) fg 4) ls 5) ff
3 page 121
assume that you are at the beginning of the first line in the vi editor. Cut the first three lines from the document and store them in the buffer.
3dd
You have just a few minutes until you need to be in a meeting. However, you want to quickly go to the end of the last line in a file you are editing in vi so that you can add several quick reminders about additional entries for the file when you resume your work on it. What command or command sequence goes right to the end of the file? 1) H 2) none 3) forward all 4) G and then $ 5) j
4
Which of the following types of commands in vi executes at the location of the cursor? 1) none 2) status-oriented commands 3) line-oriented and screen-oriented commands 4) line-oriented commands 5) screen-oriented commands
5
what symbols precedes all line-oriented commands in the vi editor?
:
Leave vi temporarily to view the current month's calendar using the cal command.
:!cal
Without exiting vi, temporarily execute the ls command to confirm that the file is saved.
:!ls
You are in the vi editor and realize that you need to perform a file listing to check the name of a file. What command can you use from vi?
:!ls
use a single vi command to delete all lines from the current file.
:1,$d
In the vi editor, search for documents and replace it with text using a line-oriented command.
:1,$s/documents/text/g
from the vi editor use a single command to delete lines five through seven
:5,7d
Use a single vi editor command to delete lines nine and ten from the current file.
:9,10d
from within the vi editor, view the vi help documentation
:help
Assume that you are viewing the help documentation from within the vi editor. Leave the documentation.
:q
Sometimes, you make changes in a document, but then decide not to save them. Exit vi without saving your changes.
:q!
You are using vi to edit a configuration file, but decide to abort the editing session (you haven't yet saved anything). What do you type from the command mode?
:q!
Assume that you are in the vi editor. Insert the contents of myfile into current file.
:r myfile
Identify the vi editor command used to copy the text from the file source.txt and put it in the current file?
:r source.txt
Enter the vi editor command that causes line numbers to appear.
:set number
To save a file and continue working in the vi editor, you would type what?
:w
save the work in your file without the vi editor.
:w
Assume that you are editing the file myfile in the vi editor. Save the file and exit vi.
:wq
save a file in vi and then exit
:wq, :x
Assume that you are in command mode. Provide the following vi editor command sequence: Blank #1) move to the fifth line of text, and Blank #2) cut the entire line to place the text on the clipboard.
Blank #1) 5G Blank #2) dd
True or False. In the vi editor, do you enter all screen-oriented commands on the status line?
False
True or False. When you are in the insert mode in the vi editor, the pound # sign is used to invoke the repeat command.
False
Identify the "go to" command to go to the beginning of the last line in the vi editor.
G
You open a large document in the vi editor and decide that you want to quickly place the cursor at the beginnign of the last line. Which command mode option do you use?
G
Use the vi editor single-letter command to go to the first line displayed on the screen.
H
identify the single-letter command to move the cursor to the upper-left corner of the screen in the vi editor
H
to move the cursor within command mode in the vi editor typing what moves the cursor to the upper-left corner of the screen?
H
Identify the single-letter command to move the cursor to the last line on the screen in the vi editor.
L
To move the cursor within command mode in the vi editor, typing which of the following moves the cursor to the last line on the screen?
L
Identify the vi editor command used to go forward one word
W
in command mode save a file in vi and then exit
ZZ
A bit is _____.
a binary digit
iles that contain non-printable characters, such as machine instructions, are called ____ files.
binary
When you start the vi editor, you are automatically in ___ mode.
command
Which of the following is a process that is used to convert source code into an executable file?
compiling
Identify the key combination to view status information for you vi editing session.
ctrl+g
Identify the vi editor command to delete the text from the cursor to end of the line
d$
In the vi editor, the ____ command deletes the current line you are working on in its entirety.
dd
Which of the following enables you to delete the current line in the command mode of vi?
dd
You have placed the cursor in vi at the beginning of line. While in the command mode, how can you delete the entire line?
dd
Identify the vi editor command to delete the current word.
dw
In vi, a screen-oriented command ____.
executes at the location of the cursor
When you are in the vi editor, you might see lines that start with a tilde(~). These lines represent storage buffers and the text after the tilde is text you have copied into a buffer that can be later pasted into your document. When you close vi, the text in these storage buffers is not saved. True or false?
false
screen-oriented commands require you specify an exact location or address for a particular operation. true or false
false line oriented commands
You have left the vi editor to access the command line to execute several commands. Return to the vi editor
fg
Your new assistant is trying to use vi, but each time he tries to type a line of text, it is not entered on the screen. What is the problem?
he is not in insert mode
Identify the command used to access insert mode in vi.
i
From the vi editor, paste the lines on the clipboard into the document.
p
Which vi command repeats the last change?
period .
____________ are files containing commands that are not typically compiled into machine code prior to running.
scripts
In the vi editor, you enter line-oriented commands on the ___________ line and press Enter when you complete the command.
status
Both vi and emacs are examples of screen editors. true or false
true
In the vi command mode, you can type dw to delete the current word to which the cursor is pointing. True or false?
true
To enter vi and create a new file after the command prompt, you would type vi filename and press enter
true
to delete the current line in the vi editor, you would use dd
true
Undo your most recent change in the vi editor.
u
How can you display the status line in vi?
use the Ctrl+g command
Open the file myfile in the vi editor.
vi myfile
start the vi editor and begin editing a file called newfile
vi newfile
Identify the vi editor command to delete the current character. (Note it is nt=ot the delete or backspace keys)
x
In the vi editor are commands that can perform more than one action referred to as line-oriented commands? yes or no
yes
In the vi editor before you can enter text in a new file, do you have to use the i command
yes
You can use what command in vi to copy specified number of lines from a file and paste them on the clipboard?
yy
Identify the vi editor command to cut the entire current line and store it on the clipboard.
yy or dd*