Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In Linux , Mac and Windows Last updated: October 29, 2022
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

An IP (Internal Protocol) address is a unique identifier that identifies a device on the internet-connected to the TCP/IP protocol and enabled communication over it. One of the most common and popular examples of a network built on IP addresses is World Wide Web and Internet.

The address of each device in an IP subnet (a kind of subset of complete IP range) should always be unique means no two devices on the same subnet can have the same IP address, otherwise, it will cause an IP address conflict.

For IPv4, its format can be 4 octets like x.x.x.x where each octet is 8 bits or 0 to 255 in decimal. Eg. IPv6 addresses support a much larger range and are formatted like y:y:y:y:y:y:y:y where each y is a segment that can range between 0 and FFFF in hexadecimal like 2001:0db8:0001:0000:0000:0ab9:C0A8:0102.

An IP address helps in location addressing of the connected device and for network interface identification.

Also, we need to remember that each connected device can have two types of IP addresses:

  • A private or Internal IP address
  • A public or External IP address

Internal IP addresses are for messaging and connectivity within the internal network. Devices with these addresses are not reachable globally and are accessible within the LAN only. Additionally, the same internal IP can be used across two different network subnets, so they are not necessarily unique identifiers.

Whereas external IP addresses are globally accessible on the internet. Since addresses are unique across the Internet, it also determines the location of the devices from where it is connecting to. Because IANA (Internet Assigned Number Authority) assigns a unique range of addresses across different countries. 


Using Command Prompt

When you run the command ipconfig on Windows’ Command Prompt, it will list down all the network adapters found on your Windows system. There could be multiple IP addresses in that list based on your connectivity like ethernet, Wi-Fi, etc.

Here’s an example:

Network and Sharing Center

Another method by which you can find your system’s/network adapter’s IP address is by opening Network and Sharing Center. For this, open the Control Panel and go to Network and Internet -> Network and Sharing Center -> Connections: <Wi-Fi>/<Ethernet> -> Details.

Here’s what it looks like:

Settings App

Open Settings app from Start menu. Then go to Network & Internet -> Select your connection type (here it is Wi-Fi) -> Hardware Properties. Below is a screenshot showing network details from Settings app:


Linux offers a range of options to check your system’s IP address. Besides GUI network manager based on the Linux distribution, there is a set of common CLI commands that are mostly supported across different distributions by default. So, we’ll be covering such commands.

ip Command

ip command has a lot of options. To list all network interfaces, use ip a command or specify the name of the network interface as shown below.

$ ip addr show eth0
6: eth0: mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:8c:b4:c4 brd ff:ff:ff:ff:ff:ff
inet brd scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::215:5dff:fe8c:b4c4/64 scope link
valid_lft forever preferred_lft forever

hostname Command

hostname command with -I flag can list down all IPs attached to your different network interfaces.

$ hostname -I

ifconfig Command

Like ip command, ifconfig used to be the default command for viewing/modifying network parameters in a Linux system though it is still supported by a lot of distributions. You can use ifconfig -a to view all network adapters and their IPs or to specify a specific network interface with ifconfig use:

$ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        inet6 fe80::215:5dff:fe8c:b4c4  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:8c:b4:c4  txqueuelen 1000  (Ethernet)
        RX packets 1339936  bytes 1152733066 (1.1 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 393472  bytes 333379281 (333.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

All the above methods will show you the internal IP of your network adapter. To view the external or public IP address from the Linux terminal, you can try any of the below common tools (do note that all these commands communicate with an external service to fetch your public IP):

$ curl
$ curl
$ curl
$ dig +short
$ host


On Mac, you can either follow GUI or terminal method to get your IP address.

GUI Method

  • Open System Preferences from Apple menu.
  • Click View in top menu and select Network.
  • Choose the right network connection from left menu.
  • On the right, you’ll be able to see the IP address of your Mac.

CLI Method

  • Open the terminal on your Mac.
  • Now, for ethernet connection you can use ipconfig getifaddr en1 command to get the IP address.


chandan@Chandans-iMac ~ % ipconfig getifaddr en1
chandan@Chandans-iMac ~ % 

IP of Websites

Besides your system’s private and public IPs, there’s public IP of websites on the Internet that you communicate over web browsers or other applications. Though you use DNS names to open a website or talk to it, computers use IP addresses in the backend to make this communication work.

We can query the IP of a website using some commonly available utilities on any system like ping, nslookup and dig. Though ping is not something exclusively used to fetch IP, it does fetch the IP in the process and it can be viewed in the output. Further, it’s a common utility available across the different OS. Here are all these commands in action:


$ ping -c4
PING ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=57 time=7.53 ms
64 bytes from ( icmp_seq=2 ttl=57 time=7.58 ms
64 bytes from ( icmp_seq=3 ttl=57 time=7.56 ms
64 bytes from ( icmp_seq=4 ttl=57 time=7.59 ms

--- ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 7.532/7.564/7.591/0.022 ms

You can explore more ping command examples.


$ nslookup

Non-authoritative answer:
Address: 2620:0:862:ed1a::3



$ dig +short

If you don’t have a terminal handy or in case, you’re not comfortable using it, fear not. There are numerous whois tools available that can get you the IP details of a website right from the browser.

One such great whois utility can be accessed from Geekflare Tools.

You can simply enter the domain name of the website you are looking to find the IP and click on Find Host button and the tool will show you the website’s IP as well as some other cool information like location and hosting details about it.


IP address is an intrinsic part of how the Internet works today. In this article, we’ve covered how private and public IP is different and how we can identify the IP address assigned to a network interface covering Windows, Linux, and Mac systems.

  • Abhishek Nair
Thanks to our Sponsors
More great readings on Linux
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder