Flickr Photos

Young Red Fox
Red Fox eating rowan berries
Roe Deer
Leopard in the rain
Lion mum taking care of cubs
Male Lion
Lion Cubs Playing
Lazy Spotted Hyena
Female Lion
Golden Jackal

Linux: Show your IP-address

Show IP-Address

How to get your IP-address:

<br />
ifconfig &quot;eth0&quot;|grep 'inet addr'|cut -d' ' -f12|cut -c6-20<br />

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

<br />
INTIP=`ifconfig eth0|grep 'inet addr'|cut -d' ' -f12|cut -c6-20`<br />
echo &quot;$INTIP&quot;<br />

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:

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

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>




This site uses Akismet to reduce spam. Learn how your comment data is processed.