Keep existing DNS servers in office and append 192.0.2.53.
Which command is appropriate?
Prefixing a list property with + appends a value; - removes it and an unprefixed assignment can replace the list.
Detailed explanation
nmcli con mod office ipv4.dns 192.0.2.53Incorrect. An unprefixed assignment can replace existing DNS values.
nmcli con mod office -ipv4.dns 192.0.2.53Incorrect. A leading minus removes a value.
nmcli con mod office +ipv4.dns 192.0.2.53Correct. +ipv4.dns appends the server to the existing list.
nmcli con show office +ipv4.dns 192.0.2.53Incorrect. connection show is read-only.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' '+ipv4.dns -> append' '-ipv4.dns -> remove'Expected result
+ipv4.dns -> append
-ipv4.dns -> removeKey points
- + appends
- - removes
- Unprefixed may replace
Notes
- Environment: property操作の表示のみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.