Skip to content

How to check the IP Address in Linux?

  • by
  • 3 min read

From locating a computer on the internet to finding chatrooms, IP addresses are everywhere. They represent whatever device you’re using to access the internet and are essential to making the internet possible.

Knowing what your IP address is can go a long way down in saving you hassle while working out networking issues. Aforementioned, they are extremely helpful in establishing communication because of the simple fact that they are the ‘address’ of your device as the internet knows it.

Many communication forms like SSH and TCP/IP wouldn’t be possible without IPs. In this article, we go over some simple ways to find out your IP address on the Linux OS.

Read more: How to check the OS version in Linux?

Checking your public IP Address

Your public IP address is the one websites and services see when you go online. If you need to know what IP represents you on the internet, you need to use this method.

Step 1: Open up the terminal

Step 2: Type in the following command

curl ifconfig.me

This command will fetch your public IP address

How to check the IP Address in Linux? | Candid.Technology
The ‘echo’ command is added simply for better readability

Alternatively, you can go to any IP checking website on the internet and can get the same results. Sites like WhatismyIP.com can show not only your IP but some other handy details as well.

Also read: 10 best YouTube downloaders and converters

Checking your local IP Address

Your local IP address is the one assigned to your device on your local network. You might need this if you’re trying to forward ports on your router or allocate bandwidth to devices on a network. Having this information is also immensely helpful in LAN gaming.

Step 1: Fire up the Linux terminal

Step 2: Enter the following command

ifconfig

Under the inet heading, you can find your local ipv4 address. The inet6 heading will show your local ipv6 address.

How to check the IP Address in Linux? | Candid.Technology
You can see the local IPs for both my ethernet and WiFi connection

Alternatively, you can also try the hostname command with the -I flag as follows

hostname -I

This command will fetch your device’s local IP address.

How to check the IP Address in Linux? | Candid.Technology

Read more: 9 reasons why developers tend to choose Linux over Windows

Yadullah Abidi

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: yadullahabidi@pm.me.

>