Server Fault is a question and answer site for system and network administrators. 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

How do I find out my IP address on a unix box? I've tried


but it doesn't exist on the system.

share|improve this question
Did you try as root? Also what OS? – Adam Jul 15 '09 at 16:41
up vote 12 down vote accepted

ifconfig is usually in /sbin. Depending on what system you're running this mightn't be on your path (in particular, RedHat systems don't include this on the default path)


$ /sbin/ifconfig

If it works then that's the issue, and you should change your path via your .bashrc (or whatever shell you're using).

export PATH=$PATH:/sbin:/usr/sbin
share|improve this answer
Thanks - it was indeed there – jjujuma Jul 15 '09 at 16:43
Some unix variants need the "-a" option passed to ifconfig to get informative output. – freiheit Jul 15 '09 at 16:48

I would suggest looking at the host command. Of course, you will have to specify the name of the machine that you are on.

share|improve this answer
This makes the assumption that the computer is on the internet, not behind NAT, has a working DNS server configured, and a hostname. If you're on a TCP/IP network that isn't connected to the internet, then this won't work. – Ernie Jul 15 '09 at 17:43

If you are behind some sort of NAT device, that device probably has an http interface that provides this information. First, find out its IP address either from the documentation or from the output of the route command. There should be a line that looks like this:

default         UG    0      0        0 ath0

Then connect to that IP address with your browser and see what you can find out. The rest depends on what kind of NAT device you're using.

share|improve this answer

Your Answer


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