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.
The wikiHow Tech Team also followed the article's instructions and verified that they work.
This article has been viewed 24,145,241 times.
Learn more...
This wikiHow teaches you how to view your computer's private and public IP addresses on a Linux computer.
Steps
-
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.
-
Open Terminal. Click or double-click the Terminal app icon, or press Ctrl+Alt+T to bring up the Terminal window.Advertisement
-
Enter the public IP command. Type curl ifconfig.me into the Terminal window. This command retrieves your public IP address from a website.[1]
-
Press ↵ Enter. Doing so runs the command.
-
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.
-
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.
-
Open Terminal. Click or double-click the Terminal app icon, or press Ctrl+Alt+T to bring up the Terminal window.
-
Enter the "Show IP" command. Type ifconfig into the Terminal window. Other commands you can try include the following:
- ip addr
- ip a
-
Press ↵ Enter. Doing so runs your command and displays the IP address information of any network items, including your computer.
-
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.
-
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.
-
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.
Community Q&A
-
QuestionWhat is an IP address?PinguTop AnswererIt 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.
-
QuestionHow can I find someone else's IP address using my own device?PinguTop AnswererIf 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.
-
QuestionWhat 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?SomoneCommunity AnswerYou 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.
Video
Tips
-
Your private IP address is the number assigned to your computer within your wireless network, while your public IP address is the address assigned to your network.Thanks
Warnings
- Avoid giving out your computer's public IP address.Thanks
About This Article
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!
Reader Success Stories
-
"It's great to have several different terminal commands to choose from. I used to call ifconfig, but that isn't installed in the Docker image I'm using at the moment. Both other commands are available."..." more