How to find your Linux system Private IP address

IP address stands for ‘Internet Protocol’ address and each devices are assigned with a specific IP address to identify the device which are connected to the network. IP Addresses can be classified into two major categories, public and private.

Also, there are two types of IP addresses, IP version 4 (IPv4) and IP version 6 (IPv6).

  • Public IP: A public IP is an IP Address that is unique and can be accessed from the Internet, which is provided by the ISP (Internet Service Provider)
  • Private IP: Private IP addresses are reserved for internal use on the private network, which are not routable over the Internet.

Refer the following guide to find your Linux system or domain Public IP address.

The following IPv4 address ranges are reserved for the private networks:


You can determine the Private IP address of your Linux system by querying the network interface using the following Linux commands:

  • ip
  • ifconfig
  • hostname
  • nmcli
  • ip route

This guide explains several methods to find the private IP Addresses of a Linux system.

Method-1: Using Hostname command

Hostname is the program that is used either to set or display the current host, domain or node name of the system. These names are used by many of the networking programs to identify the machine. The domain name is also used by NIS/YP.

# hostname -I

Method-2: Using IP command

IP command is similar to ifconfig, which is very familiar for assigning Static IP Address, Route & Default Gateway, etc.,. ifconfig command was deprecated due to no maintenance since so many years, even though it is still available on most Linux distributions. ifconfig command has been replaced by IP command which is very powerful and performing several network administration tasks with one command.

# ip a
 1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
     inet scope host lo
        valid_lft forever preferred_lft forever
     inet6 ::1/128 scope host 
        valid_lft forever preferred_lft forever
 2: eth0:  mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
     link/ether c8:5b:76:4d:d4:5c brd ff:ff:ff:ff:ff:ff
 3: wlan0:  mtu 1500 qdisc noqueue state UP group default qlen 1000
     link/ether e4:a7:a0:32:fc:e9 brd ff:ff:ff:ff:ff:ff
     inet brd scope global dynamic noprefixroute wlan0
        valid_lft 3058sec preferred_lft 3058sec
     inet6 2402:3a80:456:171d:c110:4fca:d58a:955d/64 scope global temporary dynamic 
        valid_lft 3420sec preferred_lft 3420sec
     inet6 2402:3a80:456:171d:e187:9cc7:d1b2:bb1b/64 scope global dynamic mngtmpaddr noprefixroute 
        valid_lft 3420sec preferred_lft 3420sec
     inet6 fe80::e5e8:a342:f161:a8d4/64 scope link noprefixroute 
        valid_lft forever preferred_lft forever

To print only IP address instead of full information, use the IP command with following format.

# ip addr show wlan0 | grep 'inet ' | awk '{print $2}' | cut -f1 -d'/'

Method-3 : Using ifconfig command

Ifconfig is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed. If no arguments are given, ifconfig displays the status of the currently active interfaces.

# ifconfig
wlan0     Link encap:Ethernet  HWaddr FA:16:3E:16:B8:2A
          inet addr: Bcast:  Mask:
          inet6 addr: fe80::f816:3eff:fe16:b82a/64 Scope:Link
          RX packets:21002 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15500 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:15092437 (14.3 MiB)  TX bytes:3024676 (2.8 MiB)

lo        Link encap:Local Loopback
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:298 (298.0 b)  TX bytes:298 (298.0 b)

To print only Ip address instead of full information, use the ifconfig command with following format.

# ifconfig wlan0 | grep Mask | awk '{print $2}'| cut -f2 -d:

Method-4: Using nmcli command

nmcli is a command-line tool for controlling NetworkManager and reporting network status. It is used to create, display, edit, delete, activate and deactivate network connections.

Make a note, nmcli command performs most of the task using profile name instead of device name.

$ nmcli -g ip4.address connection show '2g'

Method-5: Using ip route command

IP route command is used to configure the static route and static routes are the most secure way of routing. Also, it displays the IP routing table.

$ ip route get | awk '{print $7}'

Closing Notes

In this guide, we have shown you five commands to find your Linux system private IP address.

If you have any questions or feedback, feel free to comment below.

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

3 Comments on “How to find your Linux system Private IP address”

  1. It’s hard to find your articles in google. I found it on 20 spot, you should build quality backlinks ,
    it will help you to increase traffic. I know how to help you,
    just search in google – k2 seo tricks

Leave a Reply

Your email address will not be published. Required fields are marked *