how to find ip address linux ubuntu

How To Quickly Find the Current IP Address In Linux / Ubuntu

An IP address is the unique identifier of a computer on a network. There are many cases where knowing your IP address is important (especially for a Linux server), but it isn’t really straightforward, especially for beginners. In this article, I’ll give you a few ways to quickly find the IP address of your Linux computer or server.

Most distributions have the IP address for each network interface mentioned in the network settings. In a terminal, the commands “hostname” or “ip” can also be used to display the current IP address.

I’ll start by explaining how to find it from a desktop environment, then in the command line, and finally from your router or another computer on the same network. By the end of this tutorial, you’ll know everything about finding the IP address in any situation.

Linux doesn’t have to be intimidating. With my e-book, Master Linux Commands, you’ll uncover the secrets of the terminal in a fun, step-by-step journey. From basics to scripts, get ready to level up your Linux skills. Oh, and did I mention the handy cheat sheet you get as a bonus?

Get The Current IP Address From The Desktop Interface

If there is a desktop environment installed on the Linux computer, the easiest way to find the IP address is to open the system settings, and find the network section. In general, there is a list of the different network adapters, with the current IP address displayed for each.

The procedure to do this might be slightly different depending on which distribution or desktop environment you use. I’ll show you on GNOME/Ubuntu, but the steps should be very similar on any computer:

  • Go to the system settings.
    On Ubuntu, you can do this by clicking on the network icon in the top-right corner, and then “Settings”.
  • From the settings control panel, find the “Network” section.
  • Then click on the settings wheel for the network card you are interested in.

    Most of the time, you’ll have “Wired” and “Wireless”, but on servers, you may have more listed.
  • The current configuration of the network interface shows up, with the current IP address listed under the “Details” tab:

That’s it, you have your IP address. In most cases, it will be something like “192.168.0.X” or “192.168.1.X”.
I use virtual machines to take screenshots for RaspberryTips, that’s why I have something that seems random, but it should be “normal” on your side.

If you don’t have an IP address assigned automatically by your router, or want to change it, you can switch to the “IPv4” tab.

You can also find the MAC address here. If you are interested (to set a static IP on your DHCP for example), you can check my dedicated tutorial on this topic: How To Find The MAC Address On Ubuntu / Linux (4 ways).

Get the Current IP Address From the Command Line

On a Linux server, without a desktop interface, the commands “hostname” and “ip” can be used to quickly get the current IP address.

Here is how to use them.

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

Hostname command

The hostname command is not necessarily the most popular way to get the current IP address from a terminal on Linux, but I find it great for a beginner, as the output is straight to the point.

Without options, the hostname command will show the name of the computer, which is not what we want. But if you add this option, you’ll get the IP address:
hostname -I

As you can see, the output only includes the current IP address, nothing else.
It’s not that hard to remember and it gives you the answer directly.

Ip command

The “ip” command shows the complete network configuration of a Linux computer, including the IP address.

Join Our Community!

Connect, learn, and grow with other Raspberry Pi enthusiasts. Support RaspberryTips and enjoy an ad-free reading experience. Get exclusive monthly video tutorials and many other benefits.

Learn more

Add this option to show everything:
ip a

There is a paragraph for each network adapter, and the IP address for each one is mentioned on the third line, after the keyword “inet”.

In general, “eth0” is the wired connection and “wlan0” is the wireless adapter. The number increases for each additional network card (“eth1”, “eth2”, etc.). It’s not a hard rule, but it’s often the case.
“lo” is the localhost interface, which you don’t have to worry about.

Is ipconfig available on Linux?

“ipconfig” is a Windows command that doesn’t exist on Linux. The closest alternative is “ifconfig” which is obsolete and no longer included by default on most Linux distributions.

If like me, you try “ifconfig” all the time even though it’s no longer the current way to find an IP address, you can still install it on most distributions. For example, on a Debian-based operating system, you need this package:
sudo apt install net-tools

Once installed, you can now use it as usual:

Get The Current IP Address From Your Router

When you don’t have access to the Linux computer monitor (headless installation, for example), the easiest way to find its current IP address is to go to the DHCP server interface. In general, it’s your Internet router that does this.

The IP address of your router is generally mentioned in your computer network configuration. It will often be something like “” or “”.

  • Open your web browser, and type the IP address of your router.
  • Log in to access the configuration interface.
    You may need to find your provider documentation for more details, it’s different for each provider and router.
  • Then, find a list of the currently connected devices.
    It may look like this:
  • In this example, I can quickly find that the IP address of the computer name “DEKSTOP-7D81F0L” is, even if I don’t have access to the monitor.

Once, you know the IP address, you can use SSH, VNC or any other remote access solution you have set up for this Linux computer.

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

I know that every router has a different interface, and maybe your network even uses a separate DHCP server, so I can’t give you the exact step-by-step procedure for every situation, but I’m sure you’ll find a way.

Get The Current IP Address From Another Computer

From another computer on the same local network, it’s possible to do a network scan to get a list of all the devices connected to this network. Windows has graphical tools for this, and on Linux, the command “nmap” can be used to achieve the same result.


If you have a Windows computer on the same network as the Linux server, a tool I love is “Advanced IP Scanner”. It’s a free tool, that scans your local network and lists all the connected devices.

  • Download the application from the official website.
  • Install it on your computer, as for any program.
  • Run it and start a scan.
    It should fill the IP range with your current network configuration, but you can adjust it if needed.
  • You’ll then get a list of all the devices:

For each device, you have the name, and the network card manufacturer, so it shouldn’t be that complicated to identify the Linux computer you are looking for.


From a Linux computer, there are many possibilities.
I give you three, so pick the one that adapts better and more efficiently to your environment.

Arp cache:

A quick way to find it is to display the arp cache of your machine.
The arp cache is a list of associations’ IP ⇆ MAC addresses for your network.

On Linux or Mac you can display it by using:
$ arp -a | grep ubuntu
pat-ubuntu.home ( at aa:bb:cc:dd:ee:ff [ether] on wlxc8d7193bf721

Remove the grep command if you want to show everything.


Nmap is a network scanner used to discover computers on a network.
That’s precisely what we want to do!

If needed, you have to install it with this command for a Debian-like system:
sudo apt install nmap

Then you can use Nmap to scan the network and display all results:
$ sudo nmap -sP | grep ubuntu
Nmap scan report for pat-ubuntu.home (

The same thing here, the grep command is not mandatory.


I tell you because it can help with some systems where the other tools are not available, but it’s a very slow solution.

Ping is a tool that you probably know. It allows knowing if an IP address answers (and therefore if it is connected to the network).
There is a lesser-known option that allows you to ping your entire network, and collect responses.

You will get the list of used IP addresses and can find which one corresponds to your Raspberry Pi.
Do this command and wait:
ping -b

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

Related Questions

What’s the difference between private and public IP addresses?

A private address is the network identifier of a computer on a local network (home, company, etc.), generally assigned by the local router. A public IP address is an identifier assigned to the local network on the Internet by the Internet provider.

A local network can only use one of these three ranges:

  • Class A: to
  • Class B: to
  • Class C: to

All the other IP addresses are reserved for the Internet network. If an IP address is not is these ranges, it’s a public IP address.

How to find the public IP address?

The public IP address is generally mentioned on the Internet router interface. It can be static or change regularly. There are also many online tools to find the current public IP address.

For example, you can use this website to find your current public IP address. It will show you the current IP and your location (depends on the IP address, not always perfectly right).

Without a desktop interface, you can also use curl or wget with some tools to get it. For example, Amazon has a service that you can try:
wget -O - -q

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

If you are looking for exclusive tutorials, I post a new course each month, available for premium members only. Join the community to get access to all of them right now!

Additional Resources

Overwhelmed with Linux commands?
My e-book, “Master Linux Commands”, is your essential guide to mastering the terminal. Get practical tips, real-world examples, and a bonus cheat sheet to keep by your side.
Grab your copy now.

VIP Community
If you just want to hang out with me and other Linux fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.

Need help building something with Python?
Python is a great language to get started with programming on any Linux computer.
Learn the essentials, step-by-step, without losing time understanding useless concepts.
Get the e-book now.

Similar Posts