Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print my public IP address in the terminal using wget

I want to print my public IP address in the terminal. I found a webpage called http://ipecho.net/plain, it only displays the IP address.

What is the simplest way to print it to my bash?

Is it something close to wget http://ipecho.net/plain | cat plain or echo $(wget http://ipecho.net/plain)? (none of the above mentioned commands prints the expected output)

Thanks, Polb

like image 913
Polb Avatar asked Nov 01 '25 22:11

Polb


1 Answers

With wget, you have to tell it not to show the progress bars, and to send output to stdout instead of a file:

wget -q -O- http://ipecho.net/plain
like image 103
glenn jackman Avatar answered Nov 04 '25 16:11

glenn jackman