Several kinds of Linux query external network export IP method __linux

Source: Internet
Author: User
Tags bash script example

Curl Plain Text Format output:

Curl icanhazip.com
Curl ifconfig.me
Curl curlmyip.com
Curl ip.appspot.com Curl IPINFO.IO/IP Curl Ipecho.net/plain
Curl www.trackip.net/i

Curl JSON format output:

Curl Ipinfo.io/jsoncurl Ifconfig.me/all.jsoncurl Www.trackip.net/ip?json (a bit ugly)

Curl XML Format output:

Curl Ifconfig.me/all.xml

Curl Get all IP details (excavators)

Curl Ifconfig.me/all

Use Dydns (useful when you use the Dydns service)

Curl-s ' http://checkip.dyndns.org ' | Sed ' s/.*current IP address: \ ([0-9\.] *\). */\1/g '
curl-s http://checkip.dyndns.org/| grep-o ' [[:d Igit:].] \+"

Use Wget instead of Curl

wget Http://ipecho.net/plain-O-Q; echo
wget Http://observebox.com/ip-O-Q; Echo

Using the host and Dig commands

If so, you can also use the host and dig commands directly.

Host-t a dartsclink.com | Sed ' S/.*has address//'
dig +short myip.opendns.com @resolver1. opendns.com

Bash Script Example:

#!/bin/bash
public_ip= ' wget http://ipecho.net/plain-O-Q; Echo '
echo $PUBLIC _ip

Source: https://my.oschina.net/epstar/blog/513186

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.