Knowing how to find your IP address from the command prompt is an essential skill for troubleshooting network issues, configuring servers, or verifying your connection status. The command prompt provides a direct window into your system's network configuration, revealing information that is not always visible in standard settings menus. This guide walks you through the precise steps to uncover your IP details using command-line tools available on Windows, macOS, and Linux systems.
Understanding IP Addresses and the Command Prompt
An IP address functions as a unique identifier for your device on a network, allowing data to travel to and from your computer accurately. There are two types of addresses you will encounter: the private IP, used within your local network, and the public IP, which represents your connection to the internet at large. The command prompt, or terminal, acts as a powerful interface that bypasses graphical user interfaces to query this data directly from the operating system.
Finding Your IP Address on Windows
For users on Windows, the primary tool for this task is the ipconfig command. This utility displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. It is the fastest way to see your IPv4 address, subnet mask, and default gateway.
Steps to Execute ipconfig
Press Windows + R , type cmd , and press Enter to open the command prompt.
Type ipconfig and press Enter.
Look for the section labeled "Ethernet adapter" or "Wireless LAN adapter."
The number listed next to "IPv4 Address" is your local IP address.
Finding Your IP Address on macOS and Linux
While macOS and Linux share Unix-based foundations, the command syntax differs slightly from Windows. Instead of ipconfig , these systems rely on the ifconfig (interface configuration) or the newer ip command. These tools provide a detailed list of all network interfaces and their associated addresses.
Using ifconfig and ip Commands
Open your terminal application.
Type ifconfig and press Enter. Look for the en0 or eth0 section for your active connection.
Alternatively, you can use the command ip addr show to achieve a similar result.
The value next to "inet" is your local IP address.
Distinguishing Between Internal and External Addresses
It is crucial to understand the difference between the private IP address returned by ipconfig or ifconfig and your public IP address. The internal address (usually starting with 192.168.x.x or 10.x.x.x) is how your router identifies your device on the local network. The public address is the one seen by websites and external services, which is assigned by your Internet Service Provider (ISP).
Verifying Your Public IP Address
To find your public IP address without leaving the command prompt, you can query a web service directly from your terminal. This method leverages a command-line tool to fetch the external address reported by a remote server, saving you the step of opening a web browser.