Use the net-tools hostname command to display configured network addresses as a space-separated list.
Do not display the FQDN or short hostname.
Which command is appropriate?
hostname -I displays all configured network addresses. Lowercase -i performs hostname resolution and has a different meaning.
Detailed explanation
hostname -ICorrect. It displays all configured network addresses.
Correct. It displays all configured network addresses.
hostname -iIncorrect. Lowercase -i displays addresses resolved from the hostname.
Incorrect. Lowercase -i displays addresses resolved from the hostname.
hostname -fIncorrect. -f displays the fully qualified hostname.
Incorrect. -f displays the fully qualified hostname.
hostname -sIncorrect. -s displays the short hostname.
Incorrect. -s displays the short hostname.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' '-I=all configured addresses' '-i=resolved host address' '-f=FQDN' '-s=short name'Expected result
-I=all configured addresses
-i=resolved host address
-f=FQDN
-s=short nameKey points
- Use uppercase -I
- Distinguish lowercase -i
- Not an FQDN display
Notes
- Environment: net-tools hostnameのoption対応表
- 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.