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

I need to know the IP address of the UNIX machine. I can login to that with ssh but dont know the IP address.

Can anyone please know any command to get the ip address of the Unix machine i logged to ?

share|improve this question

migrated from Oct 17 '11 at 12:48

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

Related: – RedGrittyBrick Oct 17 '11 at 13:34
up vote 3 down vote accepted

try this code to see the IP address of unix machine

nslookup mach_name
share|improve this answer

You can use ifconfig to get the IP address of any of the interfaces on the system (note that there may well be more than one interface and more than one IP address).

Start with:

 $ ifconfig -a
share|improve this answer
Some UNIX systems do not label their interfaces en0 - a more general answer is to use ifconfig -a. Also, the ifconfig binary is not always on the PATH for ordinary users so they may need to try various incantations such as /sbin/ifconfig -a, /etc/ifconfig -a or login as root and try ifconfig -a. – RedGrittyBrick Oct 17 '11 at 13:32
Thanks - answer now updated – Paul R Oct 17 '11 at 13:33

An alternative to ipconfig is ip(8) where the output can be narrowed somewhat. For example:

$ ip -f inet addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue 
    inet scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    inet brd scope global eth0

The interface which is not loopback (lo) is the one you want:

share|improve this answer

use ifconfig and look for the inet part of the output. Note if you have more than one network card (ethernet and wireless for example) there will be more than one entry.

share|improve this answer

You must log in to answer this question.

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