LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Get IP in terminal? (https://www.linuxquestions.org/questions/linux-software-2/get-ip-in-terminal-298109/)

thetha89 03-05-2005 07:25 PM

Get IP in terminal?
 
How can you see your IP in the terminal?

Gillibiabtiag 03-05-2005 07:54 PM

ifconfig *your interface here*

For example, after becoming root, I typed

#ifconfig eth0

Although, because I was on a network, it gave me my computer's IP on the network instead of the entire network's broadcast IP.

Feminista 03-05-2005 11:02 PM

Actually, you should be able to run ifconfig with no arguments from any account (though if it's not in your user path, you might have to type the file path). No need to su or any such thing.

95se 03-05-2005 11:14 PM

^ depends on your distro, or your own permissions you set.

eelriver 03-06-2005 02:22 AM

To get your external ip address, save this and make it executable:
Code:

#!/bin/bash

wget http://checkip.dyndns.org 1>/dev/null 2>/dev/null

MYIP=`cat index.html | cut -d: -f2 | cut -d\< -f1`

rm index.html

echo "My WAN address is: $MYIP"
exit 0#



All times are GMT -5. The time now is 10:43 PM.