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
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.
Well according to this site you are incorrect the /g option will only do the current selected line. https://linuxize.com/post/vim-find-replace/#search-range
However D is the correct answer.
D