All the answer's here are technically correct, but they're not what I would consider the "right" answer. Unfortunately your question is extremely vague (which I can understand if you're not really good with how networking in linux works), so I'll give some answers to possible interpretations of the question.
The machine's primary IP
The machine has one IP above all others which is considered the machines primary IP. Note though that this is pretty meaningless, as a box can have multiple IPs and which one gets used varies (I'll get into this in a bit).
The primary IP is simply the IP associated with the machine's hostname. You can find this IP by running the following
getent hosts "$(hostname)" | awk '{ print $1 }'
Now, what this does is looks up the IP for the machine's hostname according to /etc/nsswitch.conf. In most cases, the /etc/nsswitch.conf file contains hosts: files dns. This means that when trying to do any sort of hostname or address lookups, it will look in /etc/hosts first, and then consult DNS (as configured by /etc/resolv.conf).
So the command getent hosts "$(hostname)" will likely grab the matching entry from /etc/hosts. The awk simply just grabs just the IP out of that line.
(getent is just a simple utility for querying 'databases' listed in /etc/nsswitch.conf)
The IP used to communicate with the outside world
As I mentioned earlier, the machine's primary IP is fairly meaningless. The machine can use any of multiple IPs for communication. In your case, you likely just have one interface and one (non-localhost) IP. However a server can have multiple interfaces or IPs (sometimes multiple IPs on a single interface).
Which IP gets used is determined by the kernel's routing table. I'm not going to get into the specifics of how the routing table works as its not simple (there's multiple routing tables, and which one gets used is dependent upon table selection rules). I'll just tell you how to find which IP would get used.
To find out which IP will be used to communicate with a specific destination, use the following command:
ip route get 1.2.3.4
(with 1.2.3.4 being the IP of the destination)
On my machine, if I do this with one of google.com's IPs (74.125.139.102), I get the following:
74.125.139.102 via 192.168.0.1 dev wlan0 src 192.168.0.24
cache
What this tells me is that the IP 192.168.0.24 will be used whenever my machine goes to talk to 74.125.139.102.
If you want just the IP, you can just throw an extra grep on the end.
ip route get 1.2.3.4 | grep -oP '(?<=src )\S+'
grep is used instead of an awk because it's less prone to error. It's possible the line may change in which the IP wont be in the same place, but it will always follow "src", so we just grab the value immediately after "src"
Default gateway IP
Lastly, there's the default gateway. If you don't have a specific destination to query to see which IP will be used, you can pick the one from the default gateway. If you only have one interface, this is all that'll matter anyway.
This is basically the exact same thing as above, just using the default gateway as our destination to look up
ip route get "$(ip route show to 0/0 | grep -oP '(?<=via )\S+')"
This will give you a line like the one in the above section. The src value is the IP that will be used for traffic flowing through the default gateway.
As in the previous section, to get just the IP, add a grep.
ip route get "$(ip route show to 0/0 | grep -oP '(?<=via )\S+')" | grep -oP '(?<=src )\S+'
127.0.0.0/8tolo. Again, convention. Emanuel: yes, though it seems people got the spirit of the question. Perhaps asking about the IP address of the local host (notlocalhost) would explain better. Though hosts don't have addresses. Interfaces have addresses, and possibly more than one (possibly more than two in IPv6). – Alexios Jul 3 '12 at 7:58