Sometimes, it needs to figure out what IP a server has but the server doesn’t have GUI or web browser blocked (or not installed). The examples below contain a way of obtaining public IP via CLI.
In the Windows environment you can use the next commands in the Powershell:
Resolve-DnsName -Name myip.opendns.com -Server resolver1.opendns.com
nslookup myip.opendns.com resolver1.opendns.com
(Invoke-WebRequest -Uri 'ifconfig.co/ip').Content
The classic Windows command line works only with this command:
nslookup myip.opendns.com resolver1.opendns.com

In the Linux environment you can use the next commands in the shell:
wget -O - -q ifconfig.co/ip
curl ifconfig.co/ip
host myip.opendns.com resolver1.opendns.com

๐๐๐
๐ฌDiscuss or ask a question in the Telegram๐ฌ
๐ะงะธัะฐัั ััั ะถะต ััะฐััั ะฝะฐ ััััะบะพะผ ๐ https://dzen.ru/media/samsitblog/kak-uznat-vneshnii-ip-adres-cherez-komandnuiu-stroku-64ccc74b4a27621bc21027e3