Command Line: What is My IP

command line what is my ip

As an internet user, you may have encountered situations where you need to find your IP address. An IP address is a unique identifier that distinguishes your device from others on the internet. It is used by servers and routers to route data packets to and from your device. In this article, we will explore how to find your IP address using the command line.

What is the Command Line?

The command line, also known as the terminal or shell, is a text-based interface that allows users to interact with their computer using commands. It is a powerful tool that can be used to perform a wide range of tasks, from simple file operations to complex system administration tasks.

What is an IP Address?

An IP address is a unique identifier that is assigned to every device connected to the internet. It consists of four numbers separated by dots, such as IP addresses can be either static or dynamic. Static IP addresses remain the same over time, while dynamic IP addresses are assigned by the internet service provider (ISP) and can change over time.

How to Find Your IP Address Using the Command Line

To find your IP address using the command line, follow these steps:

  1. Open the command prompt or terminal on your computer.
  2. Type the command ipconfig on Windows or ifconfig on Linux or macOS and press Enter. This will display your network configuration information, including your IP address.

Example for Windows:


Windows IP Configuration

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . :
   Subnet Mask . . . . . . . . . . . :
   Default Gateway . . . . . . . . . :

Example for Linux/macOS:

$ ifconfig

    ether 00:11:22:33:44:55
    inet6 ffff::ffff:ffff:ffff:ffff%en0 prefixlen 64 scopeid 0x4
    inet netmask 0xffffff00 broadcast
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active

In the above examples, the IP address is displayed under the IPv4 Address or inet field.

Public vs Private IP Addresses

IP addresses can be classified as either public or private. A public IP address is assigned by the ISP and can be accessed from the internet, while a private IP address is assigned by a local network and is not accessible from the internet. Private IP addresses are used for devices on a local network, while public IP addresses are used for servers and devices that need to be accessed from the internet.

Dynamic Host Configuration Protocol (DHCP)

DHCP is a protocol that is used to automatically assign IP addresses to devices on a network. It eliminates the need for manual IP address configuration and ensures that all devices on the network have a unique IP address. DHCP can be configured on a router or server and can be used to assign both private and public IP addresses.


In this article, we explored how to find your IP address using the command line. We also discussed related concepts such as public and private IP addresses, and DHCP. The command line is a powerful tool that can be used to perform a wide range of tasks, including network configuration and administration. By understanding how to use the command line to find your IP address, you can better understand your network configuration and troubleshoot network issues.