Question: Lab 5 Using VI Complete the following exercises, making sure to follow the instructions carefully. Dont forget to put your name in the top right-hand
Lab 5 Using VI
Complete the following exercises, making sure to follow the instructions carefully. Dont forget to put your name in the top right-hand corner of this document and rename the file to Lab5-Lastname, using your last name instead of lastname, before submitting via Blackboard.
Exercise 5-1
- Create a new file in vi by issuing the command vi atextfile.
- Press the i key on your keyboard to enter insert mode. A message should appear at the bottom of the screen informing you that you have successfully entered insert mode.
- Type the following line (without quotes) in the first line and hit enter: Computers are useless
- Press the esc key on your keyboard to exit insert mode and re-enter command mode.
- Type :w and then hit enter to write, or save, the file. You should receive a message at the bottom of the screen informing you that you were successful.
- Type i to enter insert mode again. Add a second line (without qoutes) to the file which says: , they can only give you answers., and a third line (without quotes) that says -Pablo Picasso.
- Press escape to enter command mode, then move your cursor to the first line and press capital J. What happened? ___________________________________________
- Press u. What happens? __________________________________________________
- Press Ctrl+r. What happens? _______________________________________________
- Type :w anothertextfile.txt. What did this command do? _______________________________________________________________________
- Press i to enter insert mode again. Add a new line to the file that says (without quotes), Neat, huh?
- Press the esc key on your keyboard to exit insert mode and re-enter command mode.
- Type :q to quit. What happened? ___________________________________________
- Type :q!. What happened? ________________________________________________
- Was the last line, entered in step 11, saved? Why or why not? ______________________________________________________________________
- Make sure to upload the two files created during this exercise when submitting this assignment on BlackBoard.
Exercise 5-2
Describe what each of the following commands do from the command mode of vi:
x __________________________________________________________ 14x __________________________________________________________
A __________________________________________________________ dw __________________________________________________________ 6dw __________________________________________________________ dd __________________________________________________________ 3dd __________________________________________________________ D __________________________________________________________
G __________________________________________________________ 4G __________________________________________________________
J __________________________________________________________ u __________________________________________________________
:w __________________________________________________________ :q __________________________________________________________
:q! __________________________________________________________ :wq __________________________________________________________
:I __________________________________________________________
Exercise 5-3
Describe the two modes of vi, how they are entered/exited from, and what they are for.
__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
