How do I know my IP address? [duplicate]

How can I see my IP address on Ubuntu? I used

ifconfig eth0

but it only displays HWaddr and I don't see where the IP address is.


Your best to use ifconfig without the interface as it may not be eth0.

ifconfig | less

will allow you to page down to see what interface is assigned an IP.

You can also cheat by using route to see what interfaces are being used.

$ route
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.138.1   0.0.0.0         UG    0      0        0 eth2

and then use ifconfig on the interfaces listed, eg.

ifconfig eth2

The following command will output all of your current IP addresses, separated by spaces:

hostname -I