Compare the name in logs with the hostname currently held by the kernel.
Do not change configuration.
Which command is appropriate?
hostname with no argument displays the current hostname. Supplying a name can be a change operation and should be distinguished in diagnostics.
Detailed explanation
hostIncorrect. host queries names through DNS or the resolver.
Incorrect. host queries names through DNS or the resolver.
hostnameCorrect. hostname without arguments prints the current hostname.
Correct. hostname without arguments prints the current hostname.
hostname app01Incorrect. hostname app01 requests a change.
Incorrect. hostname app01 requests a change.
ifconfig hostnameIncorrect. ifconfig does not use hostname as a host-name query.
Incorrect. ifconfig does not use hostname as a host-name query.
Try it yourself
An example you can run in a temporary verification environment.
hostnameExpected result
現在のホスト名1行Key points
- No argument displays
- An argument may change it
- Hostnames and DNS names can differ
Notes
- Environment: Linux hostname / 読み取り専用
- 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.