Need your device’s IP address fast? Running terminal commands is the most reliable method—no extra tools required. On Linux, macOS, or Windows, typing `ipconfig` (Windows) or `ifconfig` (Linux/macOS) displays full details, including public and local IPs. For static IP checks, combine it with `hostname` or network interfaces. Skip extra setup; the commands work out of the box.

What You'll Need

  • A computer with a terminal open (Linux/macOS come with it preinstalled; Windows requires PowerShell or CMD).
  • Basic familiarity with keyboard shortcuts (e.g., pressing Enter, selecting outputs).

Step-by-Step

  1. Open your terminal:
    • On Windows: Press Win + R, type `cmd`, then hit Enter. For PowerShell, type `powershell` and press Enter. (Labels like "CMD" or "PowerShell" may vary by Windows version.)
    • On macOS/Linux: Open the Applications folder, launch "Terminal" directly. If it’s not visible, search for "Terminal" in your app menu or dock.
  2. Find your IP address:
    1. For Windows: Type the command: ipconfig and press Enter. Look for the "IPv4 Address" under your active network connection (usually "Ethernet" or "Wi-Fi").
    2. For macOS/Linux: Type: ifconfig (older systems) or: ip a (modern systems, including newer macOS/Linux). Press Enter. Your IP will appear under "inet" for the primary network interface (e.g., eth0, wlan0).
    3. Alternative for macOS/Linux: If ifconfig fails, use: hostname -I (shows all IPv4 addresses) or: nmcli -p device show | grep IP4 (shows details for NetworkManager systems).
  3. Check public IP (optional): Use the curl command to fetch your public IP (e.g., what your ISP assigns externally). Type: curl ifconfig.me or curl icanhazip.com to see your public IP address. This differs from your local IP (e.g., 192.168.1.5) and may change if you use a proxy or VPN.

Common Mistakes

  • Typo in commands: Using ipconfigg (missing 'f') or ip a (incorrect for older macOS) will return no output. Always double-check: ipconfig (Windows) or ip a/ifconfig (macOS/Linux).
  • No active network: If your device isn't connected to Wi-Fi or Ethernet, the terminal will show no IP. Connect first, then run the command.
  • PowerShell vs. CMD: In Windows, switch between cmd (uses ipconfig) and PowerShell (uses Get-NetIPAddress). Use ipconfig for consistency.

Tips

  • Save results: Redirect output to a file for logging. On macOS/Linux: ip a > my_ip.txt On Windows (CMD): ipconfig > my_ip.txt Open the file later to review.
  • Multiple IPs: Modern systems show multiple IPs (e.g., 10.0.0.1 for VPNs). Use hostname -I (macOS/Linux) to list all IPv4 addresses cleanly.
  • Static vs. Dynamic: Static IPs (assigned manually) will persist after reboot; dynamic IPs (DHCP) change on restart. Check with the command—no extra setup needed.

Troubleshooting

If the command returns no output or errors, try these fixes in order:

  1. Restart your network: Force a network reset by unplugging your router for 30 seconds, then reconnect. Wait 1 minute before retrying the ipconfig/ifconfig command.
  2. Check for antivirus interference: Some AV tools block network commands temporarily. Temporarily disable your antivirus (e.g., Windows Defender or McAfee) and retry.
  3. Use alternative tools: If ifconfig fails on macOS (due to deprecated support), try: networksetup -getinfo Wi-Fi (macOS only). For Linux, install nmtui (NetworkManager GUI) via terminal: sudo apt install nmtui (Debian/Ubuntu).
  4. Verify system date/time: Incorrect date/time can break network commands. On Windows, open Settings > Time & Language > Date & Time > Set date and time manually. On macOS/Linux, run: timedatectl set-ntp true (Linux) to sync with a time server.
  5. Reinstall network drivers (Windows): Open Device Manager (search in Start), expand Network adapters, right-click your Wi-Fi/Ethernet adapter, and select Uninstall device. Reboot and check if ipconfig works.

Frequently Asked Questions

Why doesn’t my terminal show an IP address?

Your device may not have a network connection (Wi-Fi/Ethernet disconnected) or a valid IP assignment. First, connect to a network and restart the router (unplug for 30 seconds). If the issue persists, check your router’s DHCP settings—ensure it’s assigning IPs to devices.

How do I find my public IP without using a website?

The terminal command curl ifconfig.me fetches your public IP directly from a service without opening a browser. No extra dependencies are needed.

Can I use this on a Raspberry Pi?

Yes! Raspberry Pi’s terminal uses ifconfig (or ip a for newer versions). Type ifconfig wlan0 (for Wi-Fi) to see its IP directly on the device.

What if I don’t have PowerShell on Windows?

Skip PowerShell entirely. Use cmd with ipconfig for all Windows terminal needs. No other commands are required.

How do I check all network interfaces (not just Wi-Fi)?

On macOS/Linux, use ip a (shows all interfaces) or nmcli device status (NetworkManager). On Windows, run: netsh interface ip show config to list all active connections.

My IP changes after restarting—is that normal?

Yes, if your ISP assigns a dynamic IP via DHCP. Static IPs (manual assignment) won’t change. No action is needed—this is normal network behavior.