1. Home
  2. Linux
  3. Find ip address on linux

How to find your IP address on Linux

Every device that connects to the internet has an IP address and it is often needed when you’re configuring systems on a network to work a certain way. To find your IP address on Linux, you’ll need to take a look at your network connections. Network connections are easily accessed through the terminal interface by executing the ip addr show command.

ip addr show

When you run the above command, the terminal will print out all networking devices on the terminal, along with their individual IP address information. From here, you need to scan through this list for the networking device on this list that has a connection to the internet. If you can do that, you’ll be able to correctly locate the internal IP address your Linux PC or server is using.

Filter out your IP

Using the ip addr show command is the best, and quickest way you can find an IP address on Linux. However, running that command doesn’t just show you a plain IP address. Instead, you have to sort through to find it, which isn’t great and can take away precious time. If you only want to get an IP address in return when you run the command, you’ll need to combine it with grep. Here’s how it works.

Step 1: Remember what the first three numbers of your internal IP address are. For most, it’s going to be “192” or “10.1”.

Step 2: Take those first three numbers and combine it with the ip address command and grep. Putting them together will allow you to filter out just the IP.

ip addr show | grep "inet 192"

or

ip addr show | grep "inet 10.1"

If you run the commands together successfully, the IP address will be revealed and show up in the terminal interface, rather than a massive list of networking connection tools.

Save your IP address to a file

You may find it advantageous to save your IP address to a file for later, so when you need it, you can just read the file instead of having to re-run terminal commands. It’s also good to save IP information to a file if you have friends that need the address, etc. To do this, you can run:

ip addr show | grep "inet 192" > ~/internal-ip-info.txt

or

ip addr show | grep "inet 10.1" > ~/internal-ip-info.txt

The IP info will save to “internal-ip-info.txt” in your home folder (~). To access it, run:

cat internal-ip-info.txt

Or, to open up the file in an editable text editor (through the terminal,) try this command below instead of “cat”.

nano ~/internal-ip-info.txt

Find IP address on the Gnome Desktop

Gnome users can quickly find out their computer’s IP address right from the Gnome Shell networking settings. Being able to get this information is nice, especially if you’re new to Linux and don’t like using the terminal. To access your IP information, find the WiFi or Ethernet symbol at the top-left part of your screen and click on it with the mouse. Then, select “wired settings” (or “Wi-Fi settings” if you are on WiFi).

When you click on “wired settings” or “Wi-Fi settings,” Gnome will launch the main settings window and take you to “Network Settings.” From here, you need to locate the primary way you connect to the internet. If you use Ethernet, it will be “Wired.” The WiFi will show a list of networks, including the one you are connected to.

Next, to your network connection click the gear icon. When you click the gear icon, you’ll see a new window that summarizes the settings for your network connection. It has your local IPv4 address and your local IPv6 address.

Find IP address on the KDE Desktop

Like Gnome users, KDE Plasma users are also able to locate their IP address information right from the network settings. To find the information, make your way to the KDE Plasma 5 panel. Then, locate the network icon and click on it. When you select the network icon, you’ll see “active connections” followed by a connection that is active.

Select the active connection with your mouse, and KDE will reveal advanced settings for it. Once the advanced settings options are shown, select the “Details” tab.

In “Details,” you’ll be able to see your IPv4 address. You will also be able to see the IPv6 address information.

Find  IP addresses on GTK+ desktop environments (XFCE4, LXDE, etc)

Those on GTK+ desktop environments (not Gnome, Budgie or Gnome Shell-based ones) can access their internal IP address in a couple steps. To start, locate the network connection icon in your desktop’s panel and click on it. From there, look for the “Connection Information” option in the menu.

Selecting the “Connection Information” button will allow you to view a full readout of the network connection data. In the connection readout, you’ll see your computer’s MAC address, IPv4 address, IPv6 address, and much more!

Comments are closed.