When a user enters db01, try db01.example.test and then db01.lab.example.test.
Configure search domains in /etc/resolv.conf.
Which line is appropriate?
search DOMAIN... supplies a list of suffixes appended to short names. Too many candidates can create unnecessary queries.
Detailed explanation
nameserver example.test lab.example.testIncorrect. nameserver expects resolver addresses.
Incorrect. nameserver expects resolver addresses.
search example.test lab.example.testCorrect. It lists the two search domains in order.
Correct. It lists the two search domains in order.
hosts: example.test lab.example.testIncorrect. hosts sources belong in nsswitch.conf, not resolv.conf.
Incorrect. hosts sources belong in nsswitch.conf, not resolv.conf.
domain example.test lab.example.testIncorrect. domain normally names one domain; search handles a list.
Incorrect. domain normally names one domain; search handles a list.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'search example.test lab.example.test' | awk '{$1=""; sub(/^ /, ""); print}'Expected result
example.test lab.example.testKey points
- search accepts multiple domains
- Append suffixes to short names
- Try in listed order
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.