Donnerstag, 9. April 2009

whatismyip: curl -s myip.dk |grep ‘”Box”‘ | egrep -o ‘[0-9.]+’

Finding out your PC’s IP in Linux is a simple matter of typing ifconfig in a Terminal shell. But what if you’re behind a router? Thanks to a simple shell script, you can display your IP in the command line by simply invoking the whatismyip command.

#!/bin/bash
curl -s myip.dk |grep ‘”Box”‘ | egrep -o ‘[0-9.]+’

sudo chmod +x /usr/bin/whatismyip

Keine Kommentare: