Which of the following control mode commands is the correct way to substitute all occurrences of /dev/sdc with /dev/sdd while editing a file in vi?

Using which of the following control mode commands is the correct way to substitute all occurrences of /dev/sdc with /dev/sdd while editing a file in vi?
A. :s//dev/sdc//dev/sdd
B. :s//dev/sdc//dev/sdd/g
C. :s//dev/sdc//dev/sdd
D. :%s//dev/sdc//dev/sdd

comptia-exams

3 thoughts on “Which of the following control mode commands is the correct way to substitute all occurrences of /dev/sdc with /dev/sdd while editing a file in vi?

  1. Technically none of those answers are correct. You would need %s combined with the /g option in order to accurately answer the question. Answer D (%s/\/dev\/sdc/\/dev\/sdd) is the closest to the correct answer, however, this will only replace the FIRST occurrence on each line. You need to add the /g option to replace ALL occurrences in the file.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.