Set the local domain to example.test as the only search candidate.
Use the domain directive in /etc/resolv.conf.
Which line is appropriate?
domain DOMAIN sets one local domain. Use search when multiple suffix candidates must be tried.
Detailed explanation
domain=example.testIncorrect. The domain directive uses whitespace, not equals.
Incorrect. The domain directive uses whitespace, not equals.
domain example.testCorrect. It sets the single local domain.
Correct. It sets the single local domain.
hosts: example.testIncorrect. hosts sources belong to nsswitch.conf.
Incorrect. hosts sources belong to nsswitch.conf.
options domain:example.testIncorrect. domain is a separate resolv.conf directive, not an options value.
Incorrect. domain is a separate resolv.conf directive, not an options value.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'domain example.test' | awk '{print $1, $2}'Expected result
domain example.testKey points
- domain is one candidate
- search supports multiple
- Different from nameserver
Notes
- Environment: POSIX awk / 一時標準入力のみ
- 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.