Flickr Photos

Roe Deer
Leopard in the rain
Lion mum taking care of cubs
Male Lion
Lion Cubs Playing
Leopard
Lazy Spotted Hyena
Female Lion
Cheetah
Golden Jackal
Golden Jackal
Young Cheetah

Linux: Show your IP-address

Show IP-Address

How to get your IP-address:

ifconfig "eth0"|grep 'inet addr'|cut -d' ' -f12|cut -c6-20

and if you want to use IP-address at your own scripts just use:

INTIP=`ifconfig eth0|grep 'inet addr'|cut -d' ' -f12|cut -c6-20`
echo "$INTIP"

and now you have your IP-address on $INTIP enviroment and you can use that at your scripts.

If you want easy to change which interface IP-address you want to get just example do:

#!/bin/sh
INT="eth0";
INTIP=`ifconfig $INT|grep 'inet addr'|cut -d' ' -f12|cut -c6-20`
echo "$INTIP";

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>