DHCP IP address

Andrew yellowdog-newbie@lists.terrasoftsolutions.com
Wed, 28 Apr 2004 16:36:04 -0400


On Tue, 2004-04-27 at 13:30, jcox wrote:
> Why is there no ifconfig in YDL?  How does one go about finding out your IP
> address if it's set by DHCP?
> 
> Josh

I have ifconfig. Its in /sbin/ifconfig. Maybe /sbin is not in your PATH.
You could edit ~/.bash_profile and add some more directories:

PATH=$PATH:$HOME/bin:/sbin:/usr:/usr/bin:/usr/sbin

 and so on...

For the IP matter there is <www.whatismyip.com>

or this command:

]$ /sbin/ip addr show eth0 | grep 'inet ' | cut -d t -f2 | cut -d / -f1
| cut -b 2-

all that in one line!! (try to use copy/paste) hehehe... not very
convenient...

Lets build a simple sh script that will do this for us:

]$ su
password:
]$ kwrite &

write or copy/paste the following into the blank sheet.

#!/bin/sh
exec /sbin/ip addr show eth0 | grep 'inet ' | cut -d t -f2 | cut -d /
-f1 | cut -b 2-


# Note that this is only TWO lines. First is #!/bin/sh, second is all
the rest...from 'exec' to '2-'

save it in somewhere within the PATH$ we edited earlier... i've put mine
in /bin. Give it a mean name like 'ipplz' or 'ip?' or 'BlownJellyFish'
whatever that fits your taste!

Last step is to make this executable by everyone (remember that you
created this file as root)

]$ chmod a+x /bin/TheNameYouGaveItGoesHere

thats all! now type the name of your script in a terminal and this will
give you your IP right there!

enjoy!
Andrew





> 
> _______________________________________________
> yellowdog-newbie mailing list
> yellowdog-newbie@lists.terrasoftsolutions.com
> http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-newbie