XK0-006 · Question #96
A systems administrator is working on configuration changes and needs to replace a hostname in a specific file. Which of the following commands should the administrator use to complete this task?
The correct answer is B. sed -i 's/oldhostname/newhostname/' /etc/configuration.file. This command performs an in-place substitution, replacing the specified hostname directly within the file, which is the correct and efficient method for modifying configuration values without creating intermediate files.
Question
A systems administrator is working on configuration changes and needs to replace a hostname in a specific file. Which of the following commands should the administrator use to complete this task?
Options
- Acut. -d oldhostname /etc/configuration.file | vi newhost.name
- Bsed -i 's/oldhostname/newhostname/' /etc/configuration.file
- Ccat /etc/configuration.file | grep oldhostname > newhost.name
- Dgrep oldhostname /etc/configuration.file | awk '{print $1 newhostname}'
How the community answered
(31 responses)- A3% (1)
- B90% (28)
- D6% (2)
Explanation
This command performs an in-place substitution, replacing the specified hostname directly within the file, which is the correct and efficient method for modifying configuration values without creating intermediate files.
Topics
Community Discussion
No community discussion yet for this question.