Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

migrated from Apr 23 '10 at 3:45

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

tried /sbin/ifconfig ? – John Boker Apr 23 '10 at 3:05
Use an ioctl: – 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
up vote 3 down vote accepted

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

share|improve this answer

Have you tried:

share|improve this answer
$ ifconfig eth0

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

share|improve this answer

try with

ip address

Just to know, post a uname -a :)

share|improve this answer

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

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .