This wikiHow teaches you how to view your computer's private and public IP addresses on a Linux computer.

Method 1
Method 1 of 2:

Finding Your Public IP Address

  1. 1
    Understand when to use this method. The public IP address is what websites and services see when you access them from your computer. If you want to try to connect to your computer via a remote connection that isn't on the same network, you'll need the public IP address.
  2. 2
    Open Terminal. Click or double-click the Terminal app icon, or press Ctrl+Alt+T to bring up the Terminal window.
    Advertisement
  3. 3
    Enter the public IP command. Type curl ifconfig.me into the Terminal window. This command retrieves your public IP address from a website.[1]
  4. 4
    Press Enter. Doing so runs the command.
  5. 5
    Wait for your public IP address to appear. The IP address that appears below the command you entered is the public IP address for your network.
  6. Advertisement
Method 2
Method 2 of 2:

Finding Your Private IP Address

  1. 1
    Understand when to use this method. If you're trying to find the IP address of your computer within your Wi-Fi network (e.g., if you want to forward your router for your computer), you'll need to know the IP address.
  2. 2
    Open Terminal. Click or double-click the Terminal app icon, or press Ctrl+Alt+T to bring up the Terminal window.
  3. 3
    Enter the "Show IP" command. Type ifconfig into the Terminal window. Other commands you can try include the following:
    • ip addr
    • ip a
  4. 4
    Press Enter. Doing so runs your command and displays the IP address information of any network items, including your computer.
  5. 5
    Find your computer's heading. You'll usually find your computer's information under the "wlo1" (or "wlan0") heading, just right of the "inet" tag.[2]
  6. 6
    Review the private IP address. The IPv4 address is to the right of the "inet" tag. This is the IP address of your computer on your current network.
    • You can usually see the IPv6 address next to the "inet6" tag. The IPv6 address is less commonly used than the IPv4 address.
  7. 7
    Try the "hostname" command. On some Linux versions, such as Ubuntu, you can bring up your computer's IP address by typing in hostname -I (that's a capital "i", not a lower-case "L") and pressing Enter.
  8. Advertisement

Community Q&A

  • Question
    What is an IP address?
    Pingu
    Pingu
    Top Answerer
    It is a label that consists of four numbers separated by dots. Every computer with an internet connection is assigned an IP address. It is used so that computers can connect to each other. If you write the name of a web page into your browser's address bar, it actually looks up what IP that name refers to and then connects with that IP.
  • Question
    How can I find someone else's IP address using my own device?
    Pingu
    Pingu
    Top Answerer
    If the device the IP of which you're trying to find has a domain name, you can use the "nslookup" function. So for example, "nslookup google.com" would give you the IP address of one of Google's servers. If it doesn't, and the device connected to your device at some time, one of the many logs (located at /var/log) can contain its IP address. Other than that, there is no way to find someone else's IP address from your device, but you can use theirs.
  • Question
    What would I enter at the command prompt (terminal) on a Linux system to display a list of files and sub directories that exist within the present working directory?
    Somone
    Somone
    Community Answer
    You can type "ls" (without quotes) to list the files and directories in the present working directory and "ls -a" to list everything, including all hidden files.
Advertisement

Warnings

Advertisement

About This Article

Jack Lloyd
Written by:
wikiHow Technology Writer
This article was co-authored by wikiHow staff writer, Jack Lloyd. Jack Lloyd is a Technology Writer and Editor for wikiHow. He has over two years of experience writing and editing technology-related articles. He is technology enthusiast and an English teacher. This article has been viewed 24,100,035 times.
How helpful is this?
Co-authors: 15
Updated: March 13, 2020
Views: 24,100,035
Categories: Linux
Article SummaryX

To check your public IP address in Linux, start by clicking the Terminal app icon or simultaneously pressing “Control,” “Alt,’ and “T” to bring up the Terminal window. Once the Terminal window is open, enter the public IP command "curl ifconfig.me" to retrieve your address from a website. Press “Enter” to run the command, and wait for your public IP address to appear. Alternatively, to find your private IP address, bring up the terminal window and enter the Show IP command "ifconfig." Press Enter to run your command and display the IP address information of any network items, including your computer. In order to find your computer’s heading, look under the “wlo1” heading and review the private IP address. To learn how to use the “hostname” command to bring up your computer’s IP address, keep reading!

Did this summary help you?
Advertisement