How to find IP address on linux?

Hi everyone!

I am very new to linux so sorry for a very basic question. I would like to find out what is the IP address of my computer using the linux operating system. Can someone help?:cool:

Hi there,

the easiest way to find your IP is with ifconfig or ip command. Open up your terminal and type:

# ifconfig
or
# ip a

this will produce output similar to the one below:


eth0      Link encap:Ethernet  HWaddr 3c:97:0e:02:98:c8  
          inet addr:192.168.100.23  Bcast:192.168.100.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:20 Memory:f1600000-f1620000 

Your output will be different. if you know the name of your network interface you can also use it as and argument with ifconfig command such as:


$ /sbin/ifconfig eth0

to get IP of that particular network interface only. If you are using wireless network interface your network interface name could be wlan0:

$ /sbin/ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 8c:70:5a:92:f6:e0  
          inet addr:10.1.1.78  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::8e70:5aff:fe92:f6e0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:24557 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18095 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:17493073 (17.4 MB)  TX bytes:3226275 (3.2 MB)

Hope this helps…

Lubos

Hi everyone!

I am very new to linux so sorry for a very basic question. I would like to find out what is the IP address of my computer using the linux operating system. Can someone help?:cool:

To find the IP address(Public and Private) in your computer, goto Applications->Run->terminal->ifconfig. You can check your Network IP address by getting into any of the Linux Browsers and Visit Ip-details.com which provides the details of your Internet Service Provider, IP Location and Country etc…

Even though IFCONFIG is available and works fine on many Linux flavors, it is deprecated and substituted by IP Command.
No doubt you can use IFCONFIG, but once you try IP Command, you may never go back to IFCONFIG.

To check your IP address using IP command,
sudo ip addr show

Simple!

I try this method but it was not worked at my pc, can’t understand. Any help?

Hi Craftsleo,

What distribution and version do you run on your PC?

linux operating system: Arch

Do you get any error message when executing the above command? Something like “no such command”, or any other?

If you have installed this utility, you can also run the command
host $(hostname)