Do you want to find out the IP Address of your System in Linux? It’s easy.
Linux provides different commands like ifconfig, hostname, ip, and curl commands to get this information. An IP address is a number that identifies a computer within a network. Every day the system uses it whether you are aware of it or not.
You know, computers only understand numbers. It is like 192.168. 10.157 and 3001:0bd6:0000:0000:0000:ee00:0033:6856 in IPV4 and IPV6 format.
On top of it, there are private and public IP addresses. The private ones are those assigned an internal network. For example, a router in your house assigns an IP address to several devices connected to it. There is also the public one which is the IP address the computer uses to access the Internet.
Wondering what’s your IP Address. Let’s find it out.
Finding IP address on Linux using Terminal (Commands)
Each desktop environment has a graphical interface to obtain the computer’s IP address. However, the fastest and most efficient way is from the terminal. Also, this method works in any distribution.
Below are some of the commands which will help you to get the IP-related information.
ifconfig command
The ifconfig is the command to configure or display network interface parameters for a network by using TCP/IP. It stands for “interface configuration”.
Open a new terminal session from the main menu and run ifconfig command to list all the available network interfaces as shown below. The output displays information about all network interfaces currently in operation. The inet shows a private ipv4 address while inet6 shows an ipv6 address.
ifconfig
hostname command
The ifconfig command shows a whole lot of information. You can use the hostname command with the – I option to find IP address as shown below. The output of this command shows the private IP address on the terminal prompt.
hostname -I
Output:
192.168.1.21
ip command
The ip is another command available in Unix/Linux or Unix-like systems. This command provides a similar utility to configure the network interfaces on your system with additional functionality.
ip addr show
Check inet and inet6 values to find IP addresses.
Output:
Use the curl command to get the public IP address
Sometimes it is useful to know our public IP address. However, it is also not convenient to spread it. To do this, we will use the curl command.
You can install curl using the command given below if it is not there.
Debian, Ubuntu, Linux Mint, or any derivative:
sudo apt install curl
RHEL, CentOS 8, or Fedora
sudo dnf install curl
Read the official curl documentation and get more information.
Now, run the curl command to know your public IP Address.
curl ifconfig.me
2XX.2XX.8X.6X
Is there any GUI to see the IP Address? Yes, it is there.
Finding IP address on Linux using GUI
Many people are still afraid of the terminal and that is why they always prefer to use the graphical interface. Of course, this equally effective method is quite useful for beginners and newcomers.
So, open Settings from the main menu. You will see the following screen:
This screen shows the Wifi connections. In my case, I am using one but if you connect via a network cable, go to Network section.
So, I am connected to a wifi network called Trojan Malware and an Options button is activated. Click on it and you will see this screen:
The first screen details shows IPV4 and IPV6 IP Address. ( Check Image Above)
This is a quick and easy way if you don’t want to use the terminal.
Conclusion
In Linux, it is quite simple to obtain the IP address of the computer especially if you use the terminal. So the IP address is vital for many network services but also other processes via the Internet.
In this post, you have learned to obtain both private and public IP addresses simply. However, it is advisable not to disclose them for security reasons.
So, leave us a comment and spread this post using your social networks.