An IP address is a codename assigned to a computer on a network. It works as a postal address, ensuring that network traffic is sent to the correct computer.
In this tutorial you will learn how to find your IP address using a Linux operating system.
- A Linux operating system
- Access to a terminal window/command-line (optional) (Ctrl–Alt–T, Ctrl–Alt–F2)
Find Your IP Address From the Command Line
There are a few different commands you can use to check your IP address. To run these commands, start by opening a terminal window/command line.
Using the hostname Command
One way to check your IP address from the command-line is by using the following command:
The system will display your internal IP address.
Using the ip addr Command
Check your ip address with the
ip addr command:
The system will scan your hardware, and display the status for each network adapter you have. Look for an entry that says link/ether. Below it, you should see one of the following:
The entries will include one for a wired (Ethernet) adapter and a wireless (Wi-Fi) adapter. You may also have an entry for a virtual adapter. Generally, only one entry will have an IP address listed – that is the one you will want.
Note: The number after the slash – /24 and /64 – specifies the size of the network, and it helps with scanning and mapping network size.
Using the ifconfig Command
The third method to find your IP address involves using the ifconfig command. In the command line, enter the following:
The system will display all network connections – including connected, disconnected, and virtual. Look for the one labeled UP, BROADCAST, RUNNING, MULTICAST to find your IP address. This lists both IPv4 and IPv6 addresses.
Note: When you check your IP address, you may notice the term loopback. This refers to an IP address that returns traffic to the same computer. Usually, the loopback address is
127.0.0.1. If you see that address listed, either you are looking at the wrong line, or you are not connected to the network.
Read phoenixNAP’s ultimate Linux IP command tutorial with 31 examples to learn more!
Finding Your IP Address in Linux With a GUI
If you are using a point-and-click interface to run your Linux system, you can check your IP address by following these steps:
1. Go to the Application menu and type Settings into the search bar.
2. Click on the Settings icon that appears among the results, as in the image below:
3. Next, find the Network tab in the Settings Menu and click on the Advanced Wired Settings icon.
4. This opens a new pop-up window with details on wired settings. Here you can find both your IPv4 address and your IPv6 address.
How to Find Public IP Address
To find your public IP address, reach out to an external website.
If you are using a browser, navigate to:
If you are using a command-line or terminal, use a retrieval command like
wget to display the external IP address:
curl –s https://icanhazip.com
wget –O – –q https://checkip.amazonaws.com
Note: Did you know that when you use curl to connect to an insecure website, the output responds with an error? To resolve it, visit our guide on making curl ignore certificates.
What is a Public/Private IP Address?
Each computer in a network is required to have its own IP address. If two systems have the same IP address, it will generate errors on the network. Most modern networks will detect the problem and prompt you to fix it. However, older networks might get confused, trying to route traffic to both computers.
Most systems will have two different IP addresses:
- Private IP address: This is the address used on the network. Also, it is the one you will want to use for configuring routing tools. On smaller networks, the internal IP address typically starts with
192.168.x.x.It is dynamically assigned to your computer whenever you connect.
- Public IP address: This is the IP address that registers on a website when you visit it. When you connect to a small network, your computer connects to a router using an internal IP address. That router, in turn, connects to a bigger network (like an Internet Service Provider), which has its own IP address system.
Now you know how to find a private and public IP address in Linux using multiple methods.
Each option strikes a balance between speed and complexity. Now you have the flexibility to choose, if you only need your internal IP address, you can use the hostname method. If you need more detailed information, view our article on 31 Linux IP Commands with examples.