Know your public IP from the terminal

Simple mini How-To on how to know or look at your public IP desde linux, without using the browser to access the typical pages that exist.
In this case, I'm going to use Archlinux, but it is valid for other versions of Linux as well.

1 - First we check that we have "curl" installed like this:

pacman -ss curl

2 - In case of not having it, we install it:

pacman -S curl

In the case of my screen, I already have it installed, you give it Y and install it. 😀

3 - Now we run it either as a normal user or root as follows:

curl ifconfig.me

4 - So simple did you see?

Well I hope it helps the curious who are lazy to open the browser to see their ip.

Goal hug


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   proper said

    This command can also serve:

    wget -qO- icanhazip.com

    Greetings. -

    1.    ice said

      Oh great! thanks!

  2.   Exegesis said

    Hi, I use this command: dig + short myip.opendns.com @ resolver1.opendns.com
    without installing anything.

    regards

  3.   nameless said

    dig + short myip.opendns.com @ resolver1.opendns.com

    Please note that I do not recommend following curl / wget method due to security reasons.

    source :
    http://www.cyberciti. biz / faq / how-to-find-my-public-ip-address-from-command-line-on-a-linux

  4.   nameless said

    pacman -Ss to know if a package is installed?
    .......
    in that case:
    pac-man -Q | grep package

    something more universal (not all are archers)
    which curl &> / dev / null && echo "installed" || echo "no"

  5.   Eduardo said

    I've always used wget -qO- ifconfig.me/ip (it's an uppercase o. Not a zero)
    without installing anything, at least on debian and derivatives

  6.   álex said

    I think it is better and more immediate:
    curl ipinfo.io/ip

  7.   Enrique said

    Thank you very much for the info ! very useful, especially when you don't have a graphical environment on a server 😉
    regards