Summary

Summary

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.

Questions

1. 

What command is used to perform a forward search for a text string?

  1. /

  2. ?

  3. :

  4. !

 A.  / performs a forward search for a text string.

2. 

What command is used to perform a backward search for a text string?

  1. /

  2. ?

  3. :

  4. !

 B.  ? performs a backward search for a text string.

3. 

What command is used to run an ex editor command on the current line?

  1. /

  2. ?

  3. :

  4. !

 C.  : runs an ex editor command on the current line.

4. 

What command is used to execute a shell within vi?

  1. /

  2. ?

  3. :

  4. !

 D.  ! executes a shell within vi.

5. 

What command is used to save a file and exit vi?

  1. ZZ

  2. h

  3. j

  4. k

 A.  ZZ saves a file.

6. 

What command is used to move the cursor left?

  1. ZZ

  2. h

  3. j

  4. k

 B.  h moves the cursor left.

7. 

What command is used to move the cursor down?

  1. ZZ

  2. h

  3. j

  4. k

 C.  j moves the cursor down.

8. 

What command is used to move the cursor up?

  1. ZZ

  2. h

  3. j

  4. k

 D.  k moves the cursor up.

9. 

What command is used to move the cursor to line n?

  1. :n

  2. :$

  3. :%s/a/b/g

  4. :wq

 A.  :n  moves the cursor to line n.

10. 

What command is used to move the cursor to the end of the file?

  1. :n

  2. :$

  3. :%s/a/b/g

  4. :wq

 B.  :$ moves the cursor to the end of the file.

11. 

What command is used to replace all occurrences of string a with string b?

  1. :n

  2. :$

  3. :%s/a/b/g

  4. :wq

 C.  :%s/   a   /   b   /g replaces all occurrences of string a with string b .

12. 

What command is used to save a modified file and quit?

  1. :n

  2. :$

  3. :%s/a/b/g

  4. :wq

 D.  :wq saves a modified file and quits.

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.



Part I: Solaris 9 Operating Environment, Exam I