Web Design

Categorized | cli, Networking

Tags :

Find out your IP in Linux

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.
Do this:

cd /usr/bin
sudo nano whatismyip

In the new file paste this:

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

Close and save the file then make it executable:

sudo chmod +x /usr/bin/whatismyip

Now every thime you type whatismyip the IP assigned to you by your ISP will be printed in the Terminal window.
Original idea here.

Author Profile

T4L ;

Other posts by

Author's web site

Are you satisfied with this blog?
Why not subscribe our RSS Feed? you will always get the latest post.

1 Comment

  1. Lazy_Kent

    As always wrong quotation marks.
    ‘ should be ‘
    ” should be “


1 Trackback(s)

  1. 13 04 2009 : Averigua tu ip pública usando la terminal | Linux Zone

Leave A Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>