CompTIA Linux+ (XK0-004) — Question 77
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?
Answer options
- 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
Correct answer: A
Explanation
Option A is the correct command for substituting all instances of /dev/sdc with /dev/sdd in vi. The other options either lack the global flag 'g' or are incorrectly formatted, making them ineffective for replacing all occurrences.