You have to connect to an external provider who can look at your publicly exposed IP and print it on screen. This is required when you work with cloud services such as AWS, Azure or Google cloud and you want to verify your public IP for a number of reasons

Here is an example, using IP provider service
wget -qO- ;echo

The code in action:
[root@devopsrun1 ~]# wget -qO- ; echo

In this example, the IP address has been changed for security reasons.
We are adding an echo command to add a newline character at the end of the line, otherwise your bash prompt will appear on the same line where ip address gets printed.