There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

YSK how to get your IP address from the command line

cross-posted from: gekinzuku.com/post/98403

While it’s easy to get an IP address from popular websites such as whatismyip.com, it’s not often friendly to a context where you might need to get your IP address for command line tools.

In order to grab your IP address via the command line, there’s a page on a site called ipinfo.io/ip which only contains body content corresponding to your IP address. The easiest way to fetch that data is with the curl command (should be available on both Windows and Linux).

<pre style="background-color:#ffffff;">
<span style="color:#323232;">curl ipinfo.io/ip
</span>

It may also be beneficial to add this to your .bashrc or .aliasrc on Linux systems with something like

<pre style="background-color:#ffffff;">
<span style="color:#323232;">alias myip="curl ipinfo.io/ip"
</span>

Now you have an easy way to grab your IP address from the command line!

JoeClu ,
@JoeClu@lemmy.world avatar

Is ‘ifconfig -all’ no longer a thing?

GustavoM ,
@GustavoM@lemmy.world avatar

ip -c -br a master race

mranderson17 ,

I like to be sworn at in json:

curl myip.wtf/json

xebix ,

ipify.org is yet another.

curl api.ipify.org

Max_P ,
@Max_P@lemmy.max-p.me avatar

Another one: curlmyip.net

ono ,
<pre style="background-color:#ffffff;">
<span style="color:#323232;">curl --silent https://myipv4.p1.opendns.com/get_my_ip | jq --raw-output '.ip'
</span><span style="color:#323232;">curl --silent https://eth0.me
</span><span style="color:#323232;">curl --silent https://ifconfig.me/ip
</span><span style="color:#323232;">curl --silent https://ipecho.net/plain
</span><span style="color:#323232;">curl --silent https://ipinfo.io/ip
</span><span style="color:#323232;">dig @resolver4.opendns.com myip.opendns.com +short
</span>

That last one is generally much faster than the rest.

Also, you can add -w ‘n’ to curl commands to make it add a newline.

tla ,

ip -6 addr

sleepybear ,

curl ifconfig.io works too

erAck ,
@erAck@discuss.tchncs.de avatar
<pre style="background-color:#ffffff;">
<span style="color:#323232;">% curl ipinfo.io/ip
</span><span style="color:#323232;">curl: (7) Failed to connect to ipinfo.io port 80 after 25 ms: Connection refused
</span><span style="color:#323232;">% curl https://ipinfo.io/ip
</span><span style="color:#323232;">curl: (7) Failed to connect to ipinfo.io port 443 after 29 ms: Connection refused
</span>

They suck and apparently block curl (and lynx and elinks) from dynamic IP, it works in Firefox or on a server with static IP.

Another one is ifconfig.me/ip so

<pre style="background-color:#ffffff;">
<span style="color:#323232;">curl https://ifconfig.me/ip
</span>

that works.

graham1 OP ,
@graham1@gekinzuku.com avatar

Oh I had no clue they block curl from a dynamic IP. That’s a good alternative to have!

housepanther ,
@housepanther@lemmy.goblackcat.com avatar

You can also use curl “eth0.me

graham1 OP ,
@graham1@gekinzuku.com avatar

Nice! That’s a good short one as well, and I wasn’t aware of it before.

housepanther ,
@housepanther@lemmy.goblackcat.com avatar

I accidentally found it while I was looking for something completely unrelated and it just stuck in my mind. 😹

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • [email protected]
  • lifeLocal
  • goranko
  • All magazines