Display the IPv4 and IPv6 addresses and prefixes assigned to enp1s0.
Do not include other interfaces.
Which command is appropriate?
ip address show dev enp1s0 displays protocol addresses and prefixes assigned to the selected interface.
Detailed explanation
ip link show dev enp1s0Incorrect. link show displays link information, not the address list as its main purpose.
Incorrect. link show displays link information, not the address list as its main purpose.
ip address show dev enp1s0Correct. It displays protocol addresses and prefixes on enp1s0.
Correct. It displays protocol addresses and prefixes on enp1s0.
ip route show dev enp1s0Incorrect. route show displays routes using the interface.
Incorrect. route show displays routes using the interface.
ip neigh show dev enp1s0Incorrect. neigh show displays the neighbor cache.
Incorrect. neigh show displays the neighbor cache.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'ip address show dev enp1s0 -> inet and inet6 addresses'Expected result
ip address show dev enp1s0 -> inet and inet6 addressesKey points
- Use the address object
- Limit with dev
- Check prefixes too
Notes
- Environment: 操作対応表の表示のみ
- 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.