GIT – Use one of following commands to find public of your system using terminal. These are also useful to use in shell script.

1. Using wget

# wget http://ipecho.net/plain -O - -q ; echo

Command 2: Using curl

# curl ipecho.net/plain; echo

Command 3: Using curl

# curl -s checkip.dyndns.org| -e 's/.*Current IP Address: //' -e 's/<.*$//'

Command 4: Using curl

# curl icanhazip.com

Command 5: Using curl

# curl ifconfig.me
Get Public IP in Shell Script
#!/bin/bash

PUBLIC_IP=`wget http://ipecho.net/plain -O - -q ; echo`
echo $PUBLIC_IP

 

Print Friendly

Comments

comments

Bài viết liên quan