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.

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 stackoverflow.com Oct 17 '11 at 12:48

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

    
Related: coffer.com/mac_info/locate-unix.html –  RedGrittyBrick Oct 17 '11 at 13:34

4 Answers 4

up vote 2 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 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    inet 172.31.39.10/24 brd 172.31.39.255 scope global eth0

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

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

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.