Using a text editor is such a fundamental skill that it should be mastered as a UNIX user before attempting to become a Solaris administrator, so we ve only examined the basic operation of vi in this chapter. For more information, read the vi man page.
1. | What command is used to perform a forward search for a text string?
|
|
2. | What command is used to perform a backward search for a text string?
|
|
3. | What command is used to run an ex editor command on the current line?
|
|
4. | What command is used to execute a shell within vi?
|
|
5. | What command is used to save a file and exit vi?
|
|
6. | What command is used to move the cursor left?
|
|
7. | What command is used to move the cursor down?
|
|
8. | What command is used to move the cursor up?
|
|
9. | What command is used to move the cursor to line n ?
|
|
10. | What command is used to move the cursor to the end of the file?
|
|
11. | What command is used to replace all occurrences of string a with string b ?
|
|
12. | What command is used to save a modified file and quit?
|
|
Answers
1. | A. / performs a forward search for a text string. |
2. | B. ? performs a backward search for a text string. |
3. | C. : runs an ex editor command on the current line. |
4. | D. ! executes a shell within vi. |
5. | A. ZZ saves a file. |
6. | B. h moves the cursor left. |
7. | C. j moves the cursor down. |
8. | D. k moves the cursor up. |
9. | A. :n ‚moves the cursor to line n. |
10. | B. :$ moves the cursor to the end of the file. |
11. | C. :%s/ a / b /g replaces all occurrences of string a with string b . |
12. | D. :wq saves a modified file and quits. |