Sunday, November 8, 2020

Checking your public IP from terminal

Sometimes, when you are setting up a linux machine, there is a need to know what IP our machine is being connected to the public internet. There are many websites that provide this kind of service, but below are some of my favorites that work well with commands. 

To be able to use this, we need a text based web browser. We will use curl in this case. Install curl if your machine does not have one.

# yum install curl -y

To get our ip address, run curl like below. Choose whichever you like :).

$ curl

$ curl

The best, in my opinion is, because it will give you a nicely formatted information regarding your public IP address, and if you want a specific info, just put it as a slash being For example, if you want to know what is your city, just curl

$ curl


  "ip": "",

  "city": "Kuala Lumpur",

  "region": "Kuala Lumpur",

  "country": "MY",

  "loc": "3.1390,101.6869",

  "org": "AS4818 Digi Telecommunications Sdn. Bhd.",

  "postal": "50505",

  "timezone": "Asia/Kuala_Lumpur",

  "readme": ""


$ curl

$ curl


No comments: