Hairybloke
03-25-2001, 02:49 AM
What is the best way to find my IP address on Linux?
|
Click to See Complete Forum and Search --> : Finding IP address Hairybloke 03-25-2001, 02:49 AM What is the best way to find my IP address on Linux? Bills_a_bub 03-25-2001, 03:39 AM Best way? There may be no "best way", but several ways. Depends on your preferences. These examples assume that you are using dial-up. Try: /sbin/ifconfig ppp0 (that's a zero at the end of ppp). In the output look on the second line for "inet addr: ". Or try: tail -20 /etc/ppp/log That will show you the last 20 lines in your ppp log, which should show you the IP address that you were assigned when you connected to your ISP. I'm sure that there are a few more, but those should get you what you need. [ 25 March 2001: Message edited by: Bills_a_bub ] penguinlinux 03-25-2001, 03:49 AM hey just run the command ifconfig this will show you the ip address you have on your eth and also your ppp interfaces :) :D bdg1983 03-25-2001, 04:35 AM Here's a script you can run which will show the dhcp assigned ip. #!/bin/bash # getIP.sh # the following is one line: IPADDR=$(/sbin/ifconfig eth0|grep "inet addr" | awk '{print $2}' | awk -F: '{print $2}') printf "IP address: $IPADDR\n" Create the script named ie getIP and do a 'chmod +x /pathto/getIP' and run. justlinux.com
Copyright Internet.com Inc. All Rights Reserved. |