What command is used with vi editor to search a pattern in the forward direction? A. ?? B. // C. ? D. / E. None of the above

??
//
?
/ E. None of the above

The correct answer is D. /

The forward slash (/) is used to search for a pattern in the forward direction in vi editor. For example, if you want to search for the word “hello” in the current file, you would type /hello and then press Enter. The cursor will move to the first occurrence of the word “hello” in the file. You can then use the n and N keys to move to the next and previous occurrences of the word, respectively.

The other options are incorrect.

  • Option A, ??, is used to search for the previous occurrence of the previous search pattern.
  • Option B, //, is used to search for the next occurrence of the previous search pattern.
  • Option C, ?, is used to search for the next occurrence of the character that follows it.
  • Option E, None of the above, is incorrect because it is not a valid vi editor command.
Exit mobile version