How to know my IP in Linux

IP networks

Which is the command to know the IP in Linux? Sometimes it is necessary know our IP For many cases, it is extremely simple, but if you don't know how to do it, it can be problematic. In almost all operating systems, knowing our IP is simple, just use a command from the terminal and you will get it. In GNU / Linux it is not more complicated and it would be enough to use the equivalent of Windows ipconfig, that is, the ifconfig command.

First say that ifconfig is a very useful command not only to know our IP, but to perform many other tasks related to the network. Of course there are other alternatives to know our IP, even online options that can help you, but in this case we are going to do it locally, since we have the appropriate tools and it is good that we know how to take advantage of the full potential of our Linux distro that in most cases we do not use.

As you know, ifconfig is a program available on UNIX to configure or display parameters of the network interfaces. But in our case, we will use it to know the IP of our equipment. If you want to know more you can use the manual pages (man) of the command where all the possibilities will be detailed. But the basic syntax is as follows:

ifconfig interfaz [dirección [parámetros]]

If we simply use «ifconfig" without quotation marks In the terminal, the result that it gives you will be similar to:

eth0 Link encap 10Mps

Ethernet HWaddr 00:00:c0:90:b3:42 inet addr 192.168.1.2

Bcast 192.168.1.255 Mask 255.255.255.0 UP BROADCAST RUNNING MTU 1500 Metric 0 RX packets 3136 errors

217 dropped 7 overrun 26 TX packets 1752 errors 25 dropped 0 overrun 0

This information is very valuable and we can see different parameters, but in this article we are only interested in one, which is the IP. To know our IP in Linux, we just have to move to the line where «inet addr»And the address that appears immediately after will be our IP. In this case the IP would be 192.168.1.2.

rar-logo
Related article:
Unzip RAR on Linux

If you do not want to use commands to find out the IP in Linux, do a simple search in Google with the text "what is my IP" and you will get countless pages they will tell you what your public IP is and if you browse through a proxy.


Add as preferred source in Google