Lab (1) - System Security and Administration
Quick Review of vi Editor on Linux
In this lab, you will familiar yourself with vi which is a very powerful
editor on Linux.
It may not
be far from fact to say that all system administrators know how to use
vi to do their daily administration work.
Create a file for your answers, make sure your name appears on the
first line (10 pts penalty for files without names), and then submit the
file on ASULearn.
Open two screens on student machine and login on both screens.
There are many online resource for vi, but I have posted a short manual at vi short manual and go through Step 1 through Step 3 (ends at 3-11).
Skip Step 0. This should give you an idea on how vi works.
Once you are done with the Short manual, at the command prompt run: > spell text1 i
to make sure you have corrected all the misspelled words.
Open a new file called lab1.txt and answer the following questions in the
file. It would be very helpful to learn how to copy from one screen onto the
vi editor screen using the left mouse button. You will send a file containing your
answers as an e-mail attachement at the end of the lab. At the end of this lab, you will learn how to
send e-mails using Pine. For now, just save the file in your directory.
Q1. What is the command that opens a file in vi and starts from a line let's say n. For example, suppose you want to open the text1 file at line 2.
Q2. In vi, how would you delete n characters? For example 10 characters following the curser.
Q3. How do you replace a string with another one in the entire file? For example in the text1 file, how would you replace Unix with Linux in the entire file.
Q4. How would you delete to the beginning of a sentence?
Q5. How would you delete to the end of a sentence?
Q6. How would you search for all occurrences of string "and"? For example, and, standard, slander.
Q7. How would you search for all occurrences of the word "and"? "and" Only.
Q8. What are the differences between the following in vi?
a) i and I
b) a and A
c) o and O
d) r and R
e) u and U
Q9. How would you search backward for a particular string? For example, how would you search for string user when you are the bottom of the file?
Q10. How would you search from line 2 to line 5 for the occurrence of a string?
Submit your file on ASULearn.
Open the lab1.txt file and make sure your name is on the first line of that file.
You need to submit this file on ASUlearn. There are several ways to do this, one quick way is to use WinSCP to first transfer the file to
your PC and then upload it.