How To Check your IP Address in Linux

In this guide, we want to teach you How To Check your IP Address in Linux.

What is IP Address?

An IP address is a unique address that identifies a device on the internet or a local network. IP stands for “Internet Protocol,” which is the set of rules governing the format of data sent via the internet or local network.

In essence, IP addresses are the identifier that allows information to be sent between devices on a network: they contain location information and make devices accessible for communication. The internet needs a way to differentiate between different computers, routers, and websites. IP addresses provide a way of doing so and form an essential part of how the internet works.

An IP address is a string of numbers separated by periods. IP addresses are expressed as a set of four numbers — an example address might be Each number in the set can range from 0 to 255. So, the full IP addressing range goes from to

Most systems will have two different IP addresses:

  • A private IP address is a range of non-internet-facing IP addresses used in an internal network. Private IP addresses are provided by network devices, such as routers, using network address translation.
  • A public IP address is an IP address that can be accessed directly over the internet and is assigned to your network router by your internet service provider (ISP).

How To Check your IP Address in Linux

In this guide, you will learn to find your IP addresses by using the Linux Commands.

Now follow the steps below to complete this guide.

Find Private IP Addresses in Linux from the CLI

One of the ways that you can find your IP address is to use the hostname command.

The Linux hostname command is used to view or change a system’s domain and hostname. It can also check a computer’s IP address.

To check your internal IP address, you can run the following command:

hostname -I

The system will show your internal IP address.

Another way to check your IP is to use the “ip addr” command

The ip command is used to assign an address to a network interface and/or configure network interface parameters on Linux operating systems.

To get the depth information about your network interfaces like IP Address, and MAC Address information, run the following command:

ip addr

The system will scan your hardware, and display the status of each network adapter you have. Look for an entry that says link/ether.

Generally, only one entry will have an IP address listed – that is the one you will want.

There is another way that you can find your IP. It is the ifconfig command.

The “ifconfig” command is used for displaying current network configuration information, setting up an ip address, netmask, or broadcast address to a network interface, creating an alias for the network interface, setting up hardware address, and enabling or disabling network interfaces.

To check your IP address, run the following command:


From your output, look for the one labeled UP, BROADCAST, RUNNING, MULTICAST to find your IP address. This lists both IPv4 and IPv6 addresses.

To get more information about the ifconfig command, you can follow our guide on How To Use ifconfig in Linux.

These are some ways to find your private IP address. Let’s see how to find your public IP address.

Find Public IP Adress in Linux from CLI

As we said before, a public IP address is an IP address that can be accessed directly over the internet and is assigned to your network router by your internet service provider.

To find your public IP, you can navigate the following URL from your web browser:

Or you can navigate to:

Another way to check your public IP address is to use the curl command or wget command.

These will display your public IP address:

curl -s
wget -O - -q


At this point, you learn how to find a private and public IP address in Linux using Linux commands.

Hope you enjoy it.


Please enter your comment!
Please enter your name here
Captcha verification failed!
CAPTCHA user score failed. Please contact us!
Latest Articles


Most Popular