Powered by Blogger.

Get Public Ip using command line linux terminal / console

Get Public IP using Linux Terminal

Command 1. Using wget

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

Command 2: Using curl

# curl ipecho.net/plain; echo  

Command 3: Using wget

# wget http://observebox.com/ip -O - -q ; echo  

Command 4: Using curl

# curl icanhazip.com  

Command 5: Using curl

# curl ifconfig.me  

Get Public IP in Shell Script

We can simply use following commands in our shell script get our computers public ip and store them in a variable to use anywhere in shell script.
#!/bin/bash    PUBLIC_IP=`wget http://ipecho.net/plain -O - -q ; echo`  echo $PUBLIC_IP

Bannerad

Artikel Terpopuler

Tags

Blogumulus by Roy Tanck and Amanda Fazani