UNIX / Linux: Get External IP from Command Line

If you are behind a NAT router or firewall and if you need to know the external IP address on a UNIX or Linux workstation, the below one liners may be of help.

The following commands will output the external IP address in plain text.

For an external IP address wrapped in HTML, try these commands.

To get the external IPs from a Windows machine, run the commands from a Cygwin shell terminal.

ibrahim = { interested_in(unix, linux, android, open_source, reverse_engineering); coding(c, shell, php, python, java, javascript, nodejs, react); plays_on(xbox, ps4); linux_desktop_user(true); }