Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This should be simple, but the machines we ssh into don't seem to have the regular commands.

Are there any other simple ways I can use to get my IP?

share|improve this question
4  
tried /sbin/ifconfig ? –  John Boker Apr 23 '10 at 3:05
    
Use an ioctl: mail.nl.linux.org/kernelnewbies/2003-05/msg00090.html –  WhirlWind Apr 23 '10 at 3:07
    
I presume you need to get this programmatically, right, and you're not just trying to find out what the IP is? There are any number of ways to do either. –  Devin Ceartas Apr 23 '10 at 3:14
    
I like how so many answers and comments offer ifconfig when the title says it's not working. However, instead of saying "not working" it would be helpful if you posted error messages or other information that shows how the result differs from the expectation. –  Dennis Williamson Apr 23 '10 at 6:44
    
+1 for /sbin/ifconfig. It is most probably that ifconfig is not in your PATH, so try using it with full path to command. –  Ivan Petrushev Apr 23 '10 at 6:54
show 1 more comment

migrated from stackoverflow.com Apr 23 '10 at 3:45

This question came from our site for professional and enthusiast programmers.

7 Answers

up vote 2 down vote accepted

try /sbin/ifconfig. you can also try searching in /proc/net

share|improve this answer
add comment

If you are using ssh to access the machine, you must have the hostname. So you should be able to look up the ip address on some other machine using, for example dig hostname.

share|improve this answer
add comment

Have you tried:

/sbin/ifconfig
share|improve this answer
add comment
$ ifconfig eth0

(or replace eth0 with the device you're using) Look for: inet addr: xxx.xxx.xxx.xxx That's your IP addy.

share|improve this answer
add comment

try with

ip address

Just to know, post a uname -a :)

share|improve this answer
add comment

Well, do you mean the IP in LAN?

If you can ssh in the box [by typing "ssh address_of_the_box"], you can just ping the address_of_the_box in another box, then you can get it...

share|improve this answer
add comment

ifconfig will work. but you need to be a super user.

try this command hostname -i

even netstat -rn also will work. but it will display the routing table also along with IP.

share|improve this answer
    
No, you don't have to be superuser to retrieve the information. –  Dennis Williamson Apr 23 '10 at 6:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.