1-3-2006

10 September 2022
4.7 (114 reviews)
19 test answers

Unlock all answers in this set

Unlock answers (15)
question
Which key combination should you press in vi to save the file you are working on and quit?
answer
:wq
question
You need to create a new text file with the name network.txt in the current directory. Which command starts vi and creates the file?
answer
vi network.txt
question
You have opened the /root/myscript file in vi. While looking at the file, your soda spilled, and you hit several keys on the keyboard trying to pick it back up. There are extra characters everywhere in the file, and you know you can't fix it. How do you exit vi without saving changes?
answer
:q!
question
A friend sent you a shell script that is 117 lines long. He says that he wants you to examine code on line 82 through 87. What command would you enter while in vi command mode to go directly to line 82.
answer
#82
question
After opening a file in vi, you want to switch from command mode to command line mode. What key should you enter?
answer
:
question
You made a few changes to the /boot/grub/grub.conf and now you need to exit out of insert mode, save changes, and quit. What should you do? (Select two. Each answer is a required part of the solution)
answer
Type :wq Press esc
question
What are two methods to exit vi from command mode? (Select two. Each answer is an independent solution.)
answer
Type :wq Type ZZ
question
The inital vim mode used when vim is started. It has commands that cut and replace text, and it is the mode vi uses to enter the other modes.
answer
Command mode
question
The mode that works with the file system. Use it to save files after editing them.
answer
Command line mode
question
The mode that vim uses to write and edit text in the file.
answer
Edit mode
question
What command would you enter while in vi command mode to find the term Sam?
answer
/Sam
question
While in command mode, you copied a whole line of text to memory. You navigated to a different location in the file, and now you need to place the line of text. What command should you use?
answer
p
question
What command would enter while in vi command mode to copy an entire line of text?
answer
yy
question
Which of the following commands will cut an entire line from a file while in vi command mode?
answer
dd
question
You are editing a text file with vi and need to open a new line above the one you are currently working on. What key should you press to accomplish this?
answer
O
question
While in vi command mode, what does "k" do?
answer
move the cursor up a line
question
While in vi command mode, what does "h" do?
answer
Move the cursor one space to the left
question
While in vi command mode, what does "l" do?
answer
Move the cursor one space to the right
question
While in vi command mode, what does "j" do?
answer
Move the cursor down a line